using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class JMA_HoverText : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
// Transform of the text Objects popup window
public Transform popuptext;
// Text window bool
public static string popupon = "off";
// Controls the actions and popup information for skill buttons and their descriptions
public void OnPointerEnter(PointerEventData struggle)
{
// Check for mouse pointer
if (popupon == "off")
{
#region Evolution Skills
// Set of if statements for each button
//
// EVOLUTION SKILLS
//
// DASH ABILITY
if (gameObject.name == "Dash Skill Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "A Dash\nMove quickly in a short burst of speed.\nActive Ability";
//
popuptext.parent = GameObject.Find("Evolution Skill Menu").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Dash Skill Button Text");
//
//popuptext.gameObject.SetActive(false);
}
// TACKLE ABILITY
if (gameObject.name == "Tackle Skill Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "A Dash\nMove quickly in a short burst of speed and deal damage.\nActive Ability";
//
popuptext.parent = GameObject.Find("Evolution Skill Menu").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Tackle Skill Text");
Destroy(popuptext.gameObject, 1);
}
// SPEED UPGRADE
if (gameObject.name == "Speed+ Upgrade Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "A base stat upgrade\nIncreases overall Kaiju movement speed.\nPassive Ability";
//
popuptext.parent = GameObject.Find("Evolution Skill Menu").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Speed+ Upgrade Button");
Destroy(popuptext.gameObject, 1);
}
// ATTACK UPGRADE
if (gameObject.name == "Attack+ Upgrade Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "A base stat upgrade\nIncrease overall Kaiju physical attacks.\nPassive Ability";
//
popuptext.parent = GameObject.Find("Evolution Skill Menu").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Attack+ Upgrade Skill");
Destroy(popuptext.gameObject, 1);
}
#endregion
#region Technological Skills
//
// TECHNOLOGICAL SKILLS
//
// FIRE BREATH
if (gameObject.name == "Fire Breath Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "Long Range Attack\nShoots multiple weak projectile and consumes energy over time.\nActive Ability";
//
popuptext.parent = GameObject.Find("Tecnhnological Skill Canvas").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Fire Breath Popup");
Destroy(popuptext.gameObject, 1);
}
// TELEPORT
if (gameObject.name == "Teleport SKill Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "Long Range Mobility\nPlayer will puke put a projectile, once it lands the Kaiju will appear in the new position.\nActive Ability";
//
popuptext.parent = GameObject.Find("Tecnhnological Skill Canvas").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Teleport Popup");
Destroy(popuptext.gameObject, 1);
}
// DEFENSE UPGRADE
if (gameObject.name == "Defese+ Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<Text>().text = "A base stat upgrade\nIncrease overall Kaiju physical defense.\nPassive Ability";
//
popuptext.parent = GameObject.Find("Tecnhnological Skill Canvas").transform;
//
popuptext.SetAsLastSibling();
//
popuptext.FindChild("Defense+ Popup");
Destroy(popuptext.gameObject, 1);
}
#endregion
#region Supernatural Skills
//
// SUPERNATURAL SKILLS
//
// CONFUSE RAY
if (gameObject.name == "Confuse Ray Skill Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<TextMesh>().text = "A compelling aetherial force\nTemporarily stun enemies.\nActive Ability";
}
// MIST MODE
if (gameObject.name == "Mist Mode Skill Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<TextMesh>().text = "Immaterial ability\nThe Kaiju is immune to physical attacks for a short time.\nActive Ability";
}
// SUPERNATURAL DEFENSE
if (gameObject.name == "Supernatural Defense+ Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<TextMesh>().text = "A base stat upgrade\nIncrease overall Kaiju supernatural defense.\nPassive Ability";
}
// SUPERNATURAL OFFENSE
if (gameObject.name == "Supernatural Offense+ Button")
{
// Grabs the UI Ttext component associated with the popup window
popuptext.GetComponent<TextMesh>().text = "A base stat upgrade\nIncrease overall Kaiju supernatural attacks.\nPassive Ability";
}
#endregion
// Turns the popup text on
popupon = "on";
popuptext.gameObject.SetActive(true);
// Creates a copy of the text that the player can see in game.
Instantiate(popuptext, new Vector3(transform.position.x, transform.position.y+2, 0), popuptext.rotation);
Debug.Log("I am off");
}
}
// Exit function to turn off the text
public void OnPointerExit(PointerEventData Task)
{
if(popupon == "on")
{
popupon = "off";
popuptext.gameObject.SetActive(false);
Debug.Log("I am on");
}
}
//
public void SetSiblingIndex(int index)
{
//SetSiblingIndex.OnPointerEnter(0);
SetSiblingIndex(0);
//
}
}