Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Intro_Scritping/z_Misc_Docs/UI/UI_Tooltip.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
77 lines (60 sloc)
1.93 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
public class UI_Tooltip : MonoBehaviour { | |
public GameObject mouseTarget; | |
public static string updateField; | |
Text updates; | |
//private MetalZombieTagScript metalZombieTagScript; | |
//private JazzZombieTagScript jazzZombieTagScript; | |
public GameObject jazzZombie; | |
public GameObject metalZombie; | |
// Awake---------------------------------------------------------- | |
void Awake () | |
{ | |
//metalZombieTagScript = GetComponent<MetalZombieTagScript>(); | |
//jazzZombieTagScript = mouseTarget.GetComponent<JazzZombieTagScript>(); | |
updates = GetComponent<Text>(); | |
} | |
//start ===================================================================== | |
void Start() | |
{ | |
updateField = "..."; | |
} | |
// Update-------------------------------------------------------------- | |
void Update () | |
{ | |
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
RaycastHit hit; | |
//if (Physics.Raycast(ray, out hit)) | |
//{ | |
// if (hit.collider.gameObject.name == "JazzZombie") | |
// { | |
// Debug.Log("Jazz, bitch!"); | |
// } | |
//} | |
//if (Physics.Raycast(ray, out hit)) | |
//{ | |
// if (hit.collider.gameObject.name == "MetalZombie") | |
// { | |
// Debug.Log("Metal, mate!"); | |
// } | |
//} | |
if (Physics.Raycast(ray, out hit)) | |
{ | |
if (hit.collider.gameObject.GetComponent("JazzZombieTagScript") == true) | |
{ | |
updateField = "I like Jazz!"; | |
} | |
} | |
if (Physics.Raycast(ray, out hit)) | |
{ | |
if (hit.collider.gameObject.GetComponent("MetalZombieTagScript") == true) | |
{ | |
updateField = "I like Metal!"; | |
} | |
} | |
//Text Updates------------------------- | |
updates.text = updateField; | |
} | |
} |