コード例 #1
0
ファイル: EarthEnergyHandler.cs プロジェクト: LucasMoDz/GGJ18
    /*
     * IEnumerator fill(float time) {
     *          yield return new WaitForSeconds(.5f);
     *          float currTime = 0f;
     *          while(currTime < time) {
     *                  //Debug.Log(currTime/time);
     *                  currTime += Time.deltaTime;
     *                  laser.fillAmount = currTime/time;
     *                  yield return null;
     *          }
     *          laser.fillAmount = 1;
     *  }
     */


    //void Update() {
    //	if(earthEnergyValue == 3) {
    //		GetComponent<Image>().color = Color.cyan;
    //	}
    //	if(earthEnergyValue == 2) {
    //		GetComponent<Image>().color = Color.yellow;
    //	}
    //	else if(earthEnergyValue == 1) {
    //		GetComponent<Image>().color =  Color.red;
    //	}
    //}


    public void CheckEnergy()
    {
        switch (earthEnergyValue)
        {
        case 2:

            //Far partire effetto distruzione della prima barriera

            // Turn off shield earth
            //transform.GetChild(0).gameObject.SetActive(false);
            shields[0].gameObject.SetActive(false);
            GetComponent <Image>().color = Color.yellow;

            CheckHit();

            break;

        case 1:

            //Far partire effetto distruzione della seconda barriera
            GetComponent <Image>().color = Color.red;

            // Turn off shield earth
            //this.transform.GetChild(1).gameObject.SetActive(false);
            shields[1].gameObject.SetActive(false);

            CheckHit();

            break;

        case 0:
            //Far partire effetto distruzione della terra
            CheckHit();

            // Call open game over panel request
            GameOverEvent.OpenPanel();

            break;
        }
    }