| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | using UnityEngine;using UnityEngine.SceneManagement;using UnityEngine.UI;using System.Collections;using System.Collections.Generic;namespace EpicToonFX{public class ETFXButtonScript : MonoBehaviour{	public GameObject Button;	Text MyButtonText;	string projectileParticleName;		// The variable to update the text component of the button	ETFXFireProjectile effectScript;		// A variable used to access the list of projectiles	ETFXProjectileScript projectileScript;	public float buttonsX;	public float buttonsY;	public float buttonsSizeX;	public float buttonsSizeY;	public float buttonsDistance;		void Start ()	{		effectScript = GameObject.Find("ETFXFireProjectile").GetComponent<ETFXFireProjectile>();		getProjectileNames();		MyButtonText = Button.transform.Find("Text").GetComponent<Text>();		MyButtonText.text = projectileParticleName;	}	void Update ()	{		MyButtonText.text = projectileParticleName;//		print(projectileParticleName);	}	public void getProjectileNames()			// Find and diplay the name of the currently selected projectile	{		// Access the currently selected projectile's 'ProjectileScript'		projectileScript = effectScript.projectiles[effectScript.currentProjectile].GetComponent<ETFXProjectileScript>();		projectileParticleName = projectileScript.projectileParticle.name;	// Assign the name of the currently selected projectile to projectileParticleName	}	public bool overButton()		// This function will return either true or false	{		Rect button1 = new Rect(buttonsX, buttonsY, buttonsSizeX, buttonsSizeY);		Rect button2 = new Rect(buttonsX + buttonsDistance, buttonsY, buttonsSizeX, buttonsSizeY);				if(button1.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)) ||		   button2.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))		{			return true;		}		else			return false;	}}}
 |