Пример #1
0
        // CONSTRUCTOR: ---------------------------------------------------------------------------

        public ComboSystem(CharacterMelee melee, List <Combo> combos)
        {
            this.melee           = melee;
            this.startAttackTime = -100;

            this.root = new TreeCombo <CharacterMelee.ActionKey, Combo>(CharacterMelee.ActionKey.A);

            foreach (Combo combo in combos)
            {
                CharacterMelee.ActionKey[] actions = combo.combo;
                TreeCombo <CharacterMelee.ActionKey, Combo> node = this.root;

                for (int i = 0; i < actions.Length; ++i)
                {
                    if (node.HasChild(actions[i]))
                    {
                        node = node.GetChild(actions[i]);
                    }
                    else
                    {
                        node = node.AddChild(new TreeCombo <CharacterMelee.ActionKey, Combo>(
                                                 actions[i]
                                                 ));
                    }

                    if (i == actions.Length - 1)
                    {
                        node.SetData(combo);
                    }
                }
            }
        }
Пример #2
0
        public MeleeClip Select(CharacterMelee.ActionKey actionkey)
        {
            int currentPhase = this.GetCurrentPhase();

            if (currentPhase == -1 && this.melee.Character.characterLocomotion.isBusy)
            {
                return(null);
            }

            if (currentPhase == 0)
            {
                return(null);
            }
            if (currentPhase == 1)
            {
                return(null);
            }

            TreeCombo <CharacterMelee.ActionKey, Combo> next = this.current;

            if (next == null || this.currentCombo == null)
            {
                next = this.root;
            }

            if (!next.HasChild(actionkey))
            {
                return(null);
            }
            next = next.GetChild(actionkey);

            this.startAttackTime = Time.time;
            this.current         = next;

            this.currentCombo = this.SelectMeleeClip();;

            this.isBlock        = false;
            this.isPerfectBlock = false;

            if (this.currentCombo == null)
            {
                return(null);
            }
            return(this.currentCombo.meleeClip);
        }