예제 #1
0
 private void OnDestroy()
 {
     if (PlayerNum == 1)
     {
         p1.Wood      += Wood;
         p1.Stone     += Stone;
         p1.maxBullet += Bullet;
         p1.GetMaterial(Wood, "Wood");
         p1.GetMaterial(Stone, "Stone");
         p1.GetMaterial(Bullet, "Bullet");
     }
     else if (PlayerNum == 2)
     {
         p2.Wood      += Wood;
         p2.Stone     += Stone;
         p2.maxBullet += Bullet;
         p2.GetMaterial(Wood, "Wood");
         p2.GetMaterial(Stone, "Stone");
         p2.GetMaterial(Bullet, "Bullet");
     }
     else if (PlayerNum == 3)
     {
         p3.Wood      += Wood;
         p3.Stone     += Stone;
         p3.maxBullet += Bullet;
         p3.GetMaterial(Wood, "Wood");
         p3.GetMaterial(Stone, "Stone");
         p3.GetMaterial(Bullet, "Bullet");
     }
     else if (PlayerNum == 4)
     {
         p4.Wood      += Wood;
         p4.Stone     += Stone;
         p4.maxBullet += Bullet;
         p4.GetMaterial(Wood, "Wood");
         p4.GetMaterial(Stone, "Stone");
         p4.GetMaterial(Bullet, "Bullet");
     }
 }
예제 #2
0
 public void BulletTouch() // 버튼 이벤트 발생시 함수 작동 총알 획득
 {
     if (PlayerNum == 1)
     {
         player1.maxBullet += Bullet;
         player1.GetMaterial((float)Bullet, "Bullet");
     }
     else if (PlayerNum == 2)
     {
         player2.maxBullet += Bullet;
         player2.GetMaterial((float)Bullet, "Bullet");
     }
     else if (PlayerNum == 3)
     {
         player3.maxBullet += Bullet;
         player3.GetMaterial((float)Bullet, "Bullet");
     }
     else if (PlayerNum == 4)
     {
         player4.maxBullet += Bullet;
         player4.GetMaterial((float)Bullet, "Bullet");
     }
     gameObject.SetActive(false);
 }
예제 #3
0
 public void ondie(int Player_number) // 플레이어 번호를 받아와 데미지 및 사망 체크
 {
     if (Player_number == 1)
     {
         hp--;
         if (this.transform.tag == "wood")
         {
             Pa.Wood += (int)Wood;
             Pa.GetMaterial(Wood, "Wood");
         }
         if (this.transform.tag == "stone")
         {
             Pa.Stone += (int)Stone;
             Pa.GetMaterial(Stone, "Stone");
         }
         if (this.transform.tag == "BulletBox" && hp <= 0)
         {
             Pa.ItemWindow.GetComponent <ItemWindow>().Bullet.gameObject.SetActive(true);
             Pa.ItemWindow.GetComponent <ItemWindow>().Gun.gameObject.SetActive(true);
             Pa.ItemWindow.GetComponent <ItemWindow>().Itemsetting(Player_number);
             Pa.ItemWindow.SetActive(true);
         }
         if (hp <= 0)
         {
             if (this.transform.tag == "wood" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Tree(Num);
             }
             else if (this.transform.tag == "stone" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Stone(Num);
             }
             else if (this.transform.tag == "BulletBox" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Bullet(Num);
             }
             StartCoroutine("Destroy_Object");
         }
     }
     if (Player_number == 2)
     {
         hp--;
         if (this.transform.tag == "wood")
         {
             Pa2.Wood += (int)Wood;
             Pa2.GetMaterial(Wood, "Wood");
         }
         if (this.transform.tag == "stone")
         {
             Pa2.Stone += (int)Stone;
             Pa2.GetMaterial(Stone, "Stone");
         }
         if (this.transform.tag == "BulletBox" && hp <= 0)
         {
             Pa2.ItemWindow.GetComponent <ItemWindow>().PlayerNum = Player_number;
             Pa2.ItemWindow.GetComponent <ItemWindow>().Bullet.gameObject.SetActive(true);
             Pa2.ItemWindow.GetComponent <ItemWindow>().Gun.gameObject.SetActive(true);
             Pa2.ItemWindow.GetComponent <ItemWindow>().Itemsetting(Player_number);
             Pa2.ItemWindow.SetActive(true);
         }
         if (hp <= 0)
         {
             if (this.transform.tag == "wood" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Tree(Num);
             }
             else if (this.transform.tag == "stone" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Stone(Num);
             }
             else if (this.transform.tag == "BulletBox" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Bullet(Num);
             }
             StartCoroutine("Destroy_Object");
         }
     }
     if (Player_number == 3)
     {
         hp--;
         if (this.transform.tag == "wood")
         {
             Pa3.Wood += (int)Wood;
             Pa3.GetMaterial(Wood, "Wood");
         }
         if (this.transform.tag == "stone")
         {
             Pa3.Stone += (int)Stone;
             Pa3.GetMaterial(Stone, "Stone");
         }
         if (this.transform.tag == "BulletBox" && hp <= 0)
         {
             Pa3.ItemWindow.GetComponent <ItemWindow>().PlayerNum = Player_number;
             Pa3.ItemWindow.GetComponent <ItemWindow>().Bullet.gameObject.SetActive(true);
             Pa3.ItemWindow.GetComponent <ItemWindow>().Gun.gameObject.SetActive(true);
             Pa3.ItemWindow.GetComponent <ItemWindow>().Itemsetting(Player_number);
             Pa3.ItemWindow.SetActive(true);
         }
         if (hp <= 0)
         {
             if (this.transform.tag == "wood" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Tree(Num);
             }
             else if (this.transform.tag == "stone" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Stone(Num);
             }
             else if (this.transform.tag == "BulletBox" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Bullet(Num);
             }
             StartCoroutine("Destroy_Object");
         }
     }
     if (Player_number == 4)
     {
         hp--;
         if (this.transform.tag == "wood")
         {
             Pa4.Wood += (int)Wood;
             Pa4.GetMaterial(Wood, "Wood");
         }
         if (this.transform.tag == "stone")
         {
             Pa4.Stone += (int)Stone;
             Pa4.GetMaterial(Stone, "Stone");
         }
         if (this.transform.tag == "BulletBox" && hp <= 0)
         {
             Pa4.ItemWindow.GetComponent <ItemWindow>().PlayerNum = Player_number;
             Pa4.ItemWindow.GetComponent <ItemWindow>().Bullet.gameObject.SetActive(true);
             Pa4.ItemWindow.GetComponent <ItemWindow>().Gun.gameObject.SetActive(true);
             Pa4.ItemWindow.GetComponent <ItemWindow>().Itemsetting(Player_number);
             Pa4.ItemWindow.SetActive(true);
         }
         if (hp <= 0)
         {
             if (this.transform.tag == "wood" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Tree(Num);
             }
             else if (this.transform.tag == "stone" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Stone(Num);
             }
             else if (this.transform.tag == "BulletBox" && survive == 1)
             {
                 survive = 0;
                 Singleton.instance.Send_Bullet(Num);
             }
             StartCoroutine("Destroy_Object");
         }
     }
 }