コード例 #1
0
ファイル: BearChoise.cs プロジェクト: Silver12cat/Thesis
 public void Encounter()
 {
     isBear = false;
     if (player.GetComponent <PlayerControl>().GetInjured())
     {
         choiseScreen.SetActive(false);
         StartCoroutine(LoadMain());
         Desicion.Stop();
         Dead.Play();
     }
     else
     {
         choiseScreen.SetActive(false);
         Desicion.Stop();
         gun.Play();
         End.Play();
         bear.Stop();
         StartCoroutine(LoadEnd());
     }
 }
コード例 #2
0
ファイル: BearChoise.cs プロジェクト: Silver12cat/Thesis
 // Update is called once per frame
 void Update()
 {
     if (isBear)
     {
         if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A))
         {
             GameManager.Instance.SpawnLocation = SpotInScene1;
             GameManager.Instance.SpawnRotation = RotationInScene1;
             choiseScreen.SetActive(false);
             Desicion.Stop();
             Main.Play();
             isBear = false;
         }
         else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D))
         {
             if (player.GetComponent <PlayerControl>().GetInjured())
             {
                 choiseScreen.SetActive(false);
                 Desicion.Stop();
                 Dead.Play();
                 StartCoroutine(LoadMain());
                 isBear = false;
             }
             else
             {
                 choiseScreen.SetActive(false);
                 Desicion.Stop();
                 gun.Play();
                 End.Play();
                 bear.Stop();
                 StartCoroutine(LoadEnd());
                 isBear = false;
             }
         }
     }
 }
コード例 #3
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Enemy")
        {
            count += 1;
            print("ouch");
            if (count == 6 && player.curhealth > 0)
            {
                health           -= 1;
                player.curhealth -= 1;
                if (player.curhealth < 0)
                {
                    player.curhealth = 0;
                }
                count = 0;
            }

            else if (count >= 1 && player.curhealth <= 0)
            {
                health -= 1;
            }

            if (health > 0)
            {
                Ouch.Play();
            }
            else
            {
                Dead.Play();
            }
            print(health);
        }
        else if (other.gameObject.tag == "BBossBull")
        {
            print("ouch");
            health -= 1;
            if (health > 0)
            {
                Ouch.Play();
            }
            else
            {
                Dead.Play();
            }
            print(health);
        }
        else if (other.gameObject.tag == "eb")
        {
            print("ouch");
            health -= 1;
            if (health > 0)
            {
                Ouch.Play();
            }
            else
            {
                Dead.Play();
            }
            print(health);
        }
    }