Example #1
0
    private bool DestroyEnemy(GameObject enemy)
    {
        //IOManager.WriteFile("DestroyEnemy()が呼ばれた");
        TankStatus ts = enemy.GetComponent <TankStatus>();

        //IOManager.WriteFile(enemy.name + ": " + ts.GetIsAlive());
        if (ts.GetIsAlive())
        {
            ts.SetIsAlive(false);
            //singlemission
            if (MainGameController.gameNumber == 1)
            {
                smm.EnemyDestroy(enemy.name);
            }

            es = enemy.GetComponent <EnemyStatus>();
            sm.AddScore(es);
            SEManager.PlayDestroyTankSound();
            EffectManager.ShowBombEffect(enemy.transform.position);
            Destroy(enemy.gameObject);
            DestroyBullet(this.gameObject);
            return(true);
        }
        return(false);
    }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Enemy"))
        {
            TankStatus ts = other.gameObject.GetComponent <TankStatus>();
            if (ts.GetIsAlive())
            {
                //singlemission
                if (MainGameController.gameNumber == 1)
                {
                    smm.EnemyDestroy(other.gameObject.name);
                }
                ts.SetIsAlive(false);
                es = GameObject.Find(other.gameObject.name).GetComponent <EnemyStatus>();
                sm.AddScore(es);


                Destroy(other.gameObject);
            }
        }
        if (other.gameObject.CompareTag("Player"))
        {
            TankStatus ts = other.gameObject.GetComponent <TankStatus>();
            if (ts.GetIsAlive())
            {
                //singlemission
                if (MainGameController.gameNumber == 1)
                {
                    smm.PlayerDestroy();
                }
                else if (MainGameController.gameNumber == 2)
                {
                    ssm.PlayerDestroy();
                }
                ts.SetIsAlive(false);
                SEManager.PlayDestroyTankSound();
                EffectManager.ShowBombEffect(other.gameObject.transform.position);
                other.gameObject.SetActive(false);
                this.gameObject.SetActive(false);
            }
        }
        else if (other.gameObject.CompareTag("DestroyableWall"))
        {
            Destroy(other.gameObject);
        }
    }
Example #3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.CompareTag("Enemy"))
     {
         TankStatus ts = collision.gameObject.GetComponent <TankStatus>();
         if (ts.GetIsAlive())
         {
             ts.SetIsAlive(false);
             //singlemission
             if (MainGameController.gameNumber == 1)
             {
                 smm.EnemyDestroy(collision.gameObject.name);
             }
             EnemyStatus es = collision.gameObject.GetComponent <EnemyStatus>();
             sm.AddScore(es);
             SEManager.PlayDestroyTankSound();
             EffectManager.ShowBombEffect(collision.gameObject.transform.position);
             Destroy(collision.gameObject);
         }
     }
 }
Example #4
0
    private bool PlayerDestroy(GameObject player)
    {
        TankStatus ts = player.GetComponent <TankStatus>();

        if (ts.GetIsAlive())
        {
            ts.SetIsAlive(false);
            //singlemission
            if (MainGameController.gameNumber == 1)
            {
                smm.PlayerDestroy();
            }
            else if (MainGameController.gameNumber == 2)
            {
                ssm.PlayerDestroy();
            }
            SEManager.PlayDestroyTankSound();
            EffectManager.ShowBombEffect(player.transform.position);
            player.SetActive(false);
            this.gameObject.SetActive(false);
            return(true);
        }
        return(false);
    }