Assets.Scripts.CharacterControl.CharacterState.AddIncompatibleStates C# (CSharp) Méthode

AddIncompatibleStates() public méthode

public AddIncompatibleStates ( ) : void
Résultat void
        public void AddIncompatibleStates(params CharacterState[] states)
        {
            foreach (CharacterState state in states)
            {
                if (!IncompatibleStates.Contains(state))
                {
                    IncompatibleStates.Add(state);
                }
            }
        }

Usage Example

        private void InitializeStates()
        {
            SpriteAnimationSettings defaultAnimationSettings = new SpriteAnimationSettings(true);

            hitMissState = new CharacterState("Hit Miss", HIT_MISS_STATE_PRIORITY, HIT_MISS_STATE_ANIMATION_PRIORITY, defaultAnimationSettings);
            hitMissState.SpriteAnimationSequences = new List<SpriteAnimationSequence> { hitMissSequence };
            hitState = new CharacterState("Hit", HIT_STATE_PRIORITY, HIT_STATE_ANIMATION_PRIORITY, defaultAnimationSettings);
            hitState.SpriteAnimationSequences = new List<SpriteAnimationSequence> { hitSequence1, hitSequence2, hitSequence3 };
            comboHitState = new CharacterState("Combo Hit", COMBO_HIT_STATE_PRIORITY, COMBO_HIT_STATE_ANIMATION_PRIORITY, defaultAnimationSettings);
            comboHitState.SpriteAnimationSequences = new List<SpriteAnimationSequence> { comboHitSequence1, comboHitSequence2 };
            comboHitState.AddIncompatibleStates(new CharacterState[] { hitState, hitMissState });
            hypeAttackState = new CharacterState("Hype Attack State", HYPE_ATTACK_STATE_PRIORITY, HYPE_ATTACK_STATE_ANIMATION_PRIORITY, defaultAnimationSettings);
            hypeAttackState.SpriteAnimationSequences = new List<SpriteAnimationSequence> { hypeAttackSequence };
            hypeAttackState.AddIncompatibleStates(new CharacterState[] { hitState, hitMissState });
            deadState = new CharacterState("Dead", DEAD_STATE_PRIORITY, DEAD_STATE_ANIMATION_PRIORITY, defaultAnimationSettings);
            deadState.SpriteAnimationSequences = new List<SpriteAnimationSequence> { deathSequence };
            deadState.AddIncompatibleStates(new CharacterState[] { hitState, hitMissState , comboHitState, hypeAttackState });
            idleState = new CharacterState("Idle", IDLE_STATE_PRIORITY, IDLE_STATE_ANIMATION_PRIORITY, defaultAnimationSettings);
            idleState.SpriteAnimationSequences = new List<SpriteAnimationSequence> { idleSequence1, idleSequence2 };
            bossStateController.AddState(idleState);
        }