Exemple #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);
    }
Exemple #2
0
    private void FixedUpdate()
    {
        m_Status = CheckStatus();

        if (m_Status != TankStatus.Normal)
        {
            if (CurrentCommand != null && !CurrentCommand.IsBlocking)
            {
                m_CommandQueue.Remove(CurrentCommand);
            }
            else if (CurrentCommand != null && CurrentCommand.IsRunning && CurrentCommand.IsFinished())
            {
                m_CommandQueue.Remove(CurrentCommand);
            }
        }
        else if (CurrentCommand != null)
        {
            if (!CurrentCommand.IsRunning) // Execute the first command.
            {
                CurrentCommand.Execute();
            }
            else if (CurrentCommand.IsFinished()) // Current command finished, switch to next.
            {
                m_CommandQueue.Remove(CurrentCommand);
            }
        }
    }
Exemple #3
0
    void Start()
    {
        menu    = GameObject.Find("_MenuHandler").GetComponent <MenuHandler> ();
        boxAnim = GameObject.Find("Two Player Requirement Box").GetComponent <Animator> ();

        tankChooser = ScriptableObject.CreateInstance <TankChooser>();
        tankStatus  = ScriptableObject.CreateInstance <TankStatus>();

        player   = transform.name;
        username = gameObject.GetComponentInChildren <InputField>();
        status   = transform.Find("PlayerStatus").gameObject.GetComponentInChildren <Text>().text;
        tank     = gameObject.GetComponent <Image>();

        tankChooser.initialize(player, status, tank);
        tankStatus.initialize(transform.Find("PlayerStatus").gameObject.GetComponentInChildren <Text>(), player);
    }
Exemple #4
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);
        }
    }
Exemple #5
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);
         }
     }
 }
    private void FixedUpdate()
    {
        m_Status = CheckStatus();

        if (m_Status != TankStatus.Normal)
        {
            if (CurrentCommand != null && !CurrentCommand.IsBlocking)
                m_CommandQueue.Remove(CurrentCommand);
            else if(CurrentCommand != null && CurrentCommand.IsRunning && CurrentCommand.IsFinished())
                m_CommandQueue.Remove(CurrentCommand);
        }
        else if (CurrentCommand != null)
        { 
            if (!CurrentCommand.IsRunning) // Execute the first command.
            {
                CurrentCommand.Execute();
            }
            else if (CurrentCommand.IsFinished()) // Current command finished, switch to next.
            {
                m_CommandQueue.Remove(CurrentCommand);
            }
        }
    }
Exemple #7
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);
    }