コード例 #1
0
    public IEnumerator KillTroop(float waitTime)
    {
        if (Health <= 0 & this.troopState == TroopState.Alive)
        {
            Debug.Log(this.gameObject);
            yield return(new WaitForSeconds(waitTime));

            troopState = TroopState.Dead; //set troop to dead
            if (this.gameObject.tag != "King")
            {
                Debug.Log("HI");
                gameManager.KillPlayer(this.gameObject, this.team); //kill the player
            }

            else if (this.gameObject.tag == "King")
            {
                //end the game
                Debug.Log("hey");
                anim.win();
                yield return(new WaitForSeconds(4f));

                UI.EndGameScreen(this.gameObject);
            }
        }
    }