void Start()
    {
        m_attackList     = GetComponent <BasicAttacks>();
        m_actorReference = GetComponent <Actor>();
        m_stateList      = new List <IState>();

        m_stateQueue = new Stack <IState>(15);

        // Pre-load the state objects into the state list. This is all done at compile time.
        m_stateList.Add(new StandingState());
        m_stateList.Add(new MovementState());
        m_stateList.Add(new CrouchingState());
        m_stateList.Add(new JumpingState());
        m_stateList.Add(new AttackState());
        m_stateList.Add(new HitState());
        m_stateList.Add(new BounceState());
        m_stateList.Add(new DashingState());
        m_stateList.Add(new CancelState());


        foreach (IState item in m_stateList)
        {
            item.SetFSM(this);
        }

        currentState = m_stateList[0];
    }
Exemple #2
0
        public void addAbility(Ability ability)
        {
            //Remove the ability from any list it may be in.
            if (BasicAttacks.Contains(ability))
            {
                BasicAttacks.Remove(ability);
            }
            if (SpecialAttacks.Contains(ability))
            {
                SpecialAttacks.Remove(ability);
            }
            if (SpecialAbilities.Contains(ability))
            {
                SpecialAbilities.Remove(ability);
            }

            //Add the ability to the appropriate container.
            if (ability.Type == Ability.AbilityType.Basic)
            {
                BasicAttacks.Add(ability);
            }
            if (ability.Type == Ability.AbilityType.Special)
            {
                SpecialAttacks.Add(ability);
            }
            if (ability.Type == Ability.AbilityType.Ability || ability.Type == Ability.AbilityType.Passive)
            {
                SpecialAbilities.Add(ability);
            }

            //Update the character points
            updateCharacterPoints();
        }
Exemple #3
0
 public void removeAbility(Ability ability)
 {
     if (ability.Type == Ability.AbilityType.Basic)
     {
         BasicAttacks.Remove(ability);
     }
     if (ability.Type == Ability.AbilityType.Special)
     {
         SpecialAttacks.Remove(ability);
     }
     if (ability.Type == Ability.AbilityType.Ability || ability.Type == Ability.AbilityType.Passive)
     {
         SpecialAbilities.Remove(ability);
     }
     updateCharacterPoints();
 }