viewing paste Unknown #44907 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
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);
 
        //
        
    }
}
 
Viewed 983 times, submitted by Guest.