예제 #1
0
    ///////////////////////////////////////////////////////////////////////////////////////

    //Assign state machines to the characters
    void AssignStateMachines()
    {
        foreach (GameObject Char in PlayerChars)
        {
            Char.tag = "Player";
            Char.AddComponent <PlayerStateMachine>();
            Char.GetComponent <PlayerStateMachine>().Wrestler      = Char;
            Char.GetComponent <PlayerStateMachine>().BSM           = this;
            Char.GetComponent <PlayerStateMachine>().startPosition = Char.transform.position;
            Char.GetComponent <PlayerStateMachine>().Stats         = Char.GetComponent <CharStats>();
        }

        foreach (GameObject Char in EnemyChars)
        {
            Char.tag = "Enemy";
            Char.AddComponent <EnemyStateMachine>();
            Char.GetComponent <EnemyStateMachine>().Wrestler      = Char;
            Char.GetComponent <EnemyStateMachine>().BSM           = this;
            Char.GetComponent <EnemyStateMachine>().startPosition = Char.transform.position;
            Char.GetComponent <EnemyStateMachine>().Stats         = Char.GetComponent <CharStats>();
        }
    }