Exemplo n.º 1
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);
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.transform.root.gameObject.CompareTag("Player"))
        {
            //singlemission
            if (MainGameController.gameNumber == 1)
            {
                smm.PlayerDestroy();
            }
            else if (MainGameController.gameNumber == 2)
            {
                ssm.PlayerDestroy();
            }

            other.transform.root.gameObject.SetActive(false);
            this.gameObject.SetActive(false);
        }
    }
Exemplo n.º 3
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);
    }