Ejemplo n.º 1
0
 private void Update()
 {
     countTime += Time.deltaTime;
     if (!this.shooterHitAble)
     {
         if (countTime > 0.5f)
         {
             this.shooterHitAble = true;
         }
     }
     else if (countTime > 1f) //1秒ごとに発射戦車が生きてるか確認。いないなら10秒後消滅(壁に当たらない遅くなった弾を考慮)
     {
         try
         {
             if (shooterTank == null)
             {
                 StartCoroutine(DelayMethod(10f, () =>
                 {
                     SEManager.PlayDestroyBulletSound();
                     Destroy(this.gameObject);
                 }));
             }
         }catch (Exception)
         {
             SEManager.PlayDestroyBulletSound();
             Destroy(this.gameObject);
         }
         countTime = 0f;
     }
 }
Ejemplo n.º 2
0
 public void DestroyBullet(GameObject bullet)
 {
     try
     {
         if (shooterTank == null)
         {
             SEManager.PlayDestroyBulletSound();
             Destroy(this.gameObject);
         }
     }
     catch (Exception e)
     {
         Debug.Log(e);
         SEManager.PlayDestroyBulletSound();
         Destroy(this.gameObject);
     }
     try
     {
         if (bullet.name == "Bullet(Clone)")
         {
             this.shotBullet.GetComponent <ShotBullet>().DestroyBullet();
         }
         else if (bullet.CompareTag("EnemyBullet"))
         {
             this.shotBullet.GetComponent <EnemyShotManager>().DestroyBullet();
         }
         else if (bullet.name == "Bullet3(Clone)")
         {
             if (MainGameController.gameNumber == 1 && SingleMissionStaticData.selectTankNumber == 22)
             {
                 this.shotBullet.GetComponent <ShotBullet>().DestroyBullet();
             }
             else if (MainGameController.gameNumber == 2 && SingleSurvivalStaticData.selectTankNumber == 22)
             {
                 this.shotBullet.GetComponent <ShotBullet>().DestroyBullet();
             }
         }
     }
     catch (MissingReferenceException)
     {
         SEManager.PlayDestroyBulletSound();
         Destroy(this.gameObject);
     }
     SEManager.PlayDestroyBulletSound();
     Destroy(this.gameObject);
 }