private ShowStarNumber star; //Define the ShowStarNumber variable to check the number of star and the cost of the defender // Use this for initialization void Start() { //Check whether the parent Gameobject exsit or not. If not, create a new GameObject defenderParent = GameObject.Find("Defenders"); if (defenderParent == null) { defenderParent = new GameObject("Defenders"); } star = GameObject.FindObjectOfType <ShowStarNumber> (); //Get the ShowStarNumber }
public int defenderCost = 100; //Define the cost of the defender // Use this for initialization void Start() { shoot = GetComponent <Shooter> (); //Get the shooter variable anim = GetComponent <Animator> (); //Get the Animator variable star = GameObject.FindObjectOfType <ShowStarNumber> (); //Get the ShowStarNumber variable }