public int frameCount   = 16; // some updates we want slower maybe update every 2,4, etc frames

    // Start is called before the first frame update
    void Start()
    {
        health          = maxHealth;
        healthBarScript = canvas.transform.Find("HealthBar").GetComponent <healthBarScript>();

        diamondAbsoluteValue  = 0;
        diamondDisplayedValue = 0;
        diamondValueScript    = canvas.transform.Find("DiamondImage").Find("Text").GetComponent <diamondValueScript>();
    }
Ejemplo n.º 2
0
	// Use this for initialization
	public void Start () {
		commandQueue = new command[commandQueueSize];
		selected = null;
		destroyHighlighting = false;
		highlighting = false;
		colRadius = gameObject.GetComponent<CircleCollider2D>().radius;
		selectedAsset = transform.parent.gameObject.GetComponent<teamScript>().selectedAsset;
		highlightAsset = transform.parent.gameObject.GetComponent<teamScript>().highlightAsset;
		activatedAsset = transform.parent.gameObject.GetComponent<teamScript>().activatedAsset;
		unitsLayer = transform.parent.parent.gameObject.GetComponent<allTeamsScript>().unitsLayer;
		commandQueueSize = transform.parent.parent.gameObject.GetComponent<allTeamsScript>().commandQueueSize;
		_healthBar = transform.GetComponentInChildren<healthBarScript>();
		startFun();
	}
Ejemplo n.º 3
0
    void Awake()
    {
        //SpriteRenderer renderer = this.GetComponent<SpriteRenderer>();

        // Get access to health bar
        Transform[] allChildren = GetComponentsInChildren <Transform>();
        foreach (Transform child in allChildren)
        {
            //Debug.Log(child.name);
            if (child.name == "healthBar")
            {
                healthBarObj = child.gameObject;
                healthBarObj.GetComponent <Image>().enabled = false;
                hpScript = healthBarObj.GetComponent <healthBarScript>();
            }

            if (child.name == "enemySprite")
            {
                //currentSpriteObj = GameObject.Find("enemySprite");
                currentSpriteObj = child.gameObject;
                currentSpriteObj.GetComponent <SpriteRenderer>().enabled = false;
            }

            if (child.name == "coinAnimation")
            {
                coinAnimObj = child.gameObject;
                coinAnimObj.GetComponent <Image>().enabled = false;
            }
        }

        /*
         * for (int i = 0; i < gameObject.transform.childCount - 1; i++)
         * {
         *  Debug.Log(gameObject.transform.GetChild(i).transform.name);
         *  if (gameObject.transform.GetChild(i).transform.name == "healthBar")
         *  {
         *      gameObject.transform.GetChild(i).transform.GetComponent<Image>().enabled = false;
         *      hpScript = gameObject.transform.GetChild(i).transform.GetComponent<healthBarScript>();
         *  }
         * }*/

        //healthBarObj = GameObject.Find("healthBar");
        //healthBarObj.GetComponent<Image>().enabled = false;
        //hpScript = healthBarObj.GetComponent(typeof(healthBarScript)) as healthBarScript;

        // Get access to sprite
        //currentSpriteObj = GameObject.Find("enemySprite");
        //currentSpriteObj.GetComponent<SpriteRenderer>().enabled = false;
    }