protected virtual MovesetAttackNode CheckStartingNodes()
        {
            switch (manager.IsGrounded)
            {
            case true:
                MovesetAttackNode groundCommandNormal = CheckAttackNodes(ref CurrentMoveset.groundAttackCommandNormals);
                if (groundCommandNormal != null)
                {
                    return(groundCommandNormal);
                }
                MovesetAttackNode groundNormal = CheckAttackNodes(ref CurrentMoveset.groundAttackStartNodes);
                if (groundNormal != null)
                {
                    return(groundNormal);
                }
                break;

            case false:
                MovesetAttackNode airCommandNormal = CheckAttackNodes(ref CurrentMoveset.airAttackCommandNormals);
                if (airCommandNormal != null)
                {
                    return(airCommandNormal);
                }
                MovesetAttackNode airNormal = CheckAttackNodes(ref CurrentMoveset.airAttackStartNodes);
                if (airNormal != null)
                {
                    return(airNormal);
                }
                break;
            }
            return(null);
        }
 protected virtual MovesetAttackNode CheckAttackNodes(ref List <MovesetAttackNode> nodes)
 {
     for (int i = 0; i < nodes.Count; i++)
     {
         MovesetAttackNode man = CheckAttackNode(nodes[i]);
         if (man != null)
         {
             return(man);
         }
     }
     return(null);
 }
Exemplo n.º 3
0
        public virtual bool TryAttack()
        {
            MovesetAttackNode man = CombatManager.TryAttack();

            if (man != null)
            {
                CombatManager.SetAttack(man);
                StateManager.ChangeState((int)EntityStates.ATTACK);
                return(true);
            }
            return(false);
        }
        protected virtual MovesetAttackNode CheckAttackNode(MovesetAttackNode node)
        {
            if (node.attackDefinition == null)
            {
                return(null);
            }

            if (CheckForInputSequence(node.inputSequence))
            {
                return(node);
            }
            return(null);
        }
 protected virtual MovesetAttackNode CheckCurrentAttackCancelWindows()
 {
     for (int i = 0; i < CurrentAttack.nextNode.Count; i++)
     {
         if (manager.StateManager.CurrentStateFrame >= CurrentAttack.nextNode[i].cancelWindow.x &&
             manager.StateManager.CurrentStateFrame <= CurrentAttack.nextNode[i].cancelWindow.y)
         {
             MovesetAttackNode man = CheckAttackNode(CurrentAttack.nextNode[i].node);
             if (man != null)
             {
                 return(man);
             }
         }
     }
     return(null);
 }
        public virtual MovesetAttackNode TryCommandAttack()
        {
            switch (manager.IsGrounded)
            {
            case true:
                MovesetAttackNode groundCommandNormal = CheckAttackNodes(ref CurrentMoveset.groundAttackCommandNormals);
                if (groundCommandNormal != null)
                {
                    return(groundCommandNormal);
                }
                break;

            case false:
                MovesetAttackNode airCommandNormal = CheckAttackNodes(ref CurrentMoveset.airAttackCommandNormals);
                if (airCommandNormal != null)
                {
                    return(airCommandNormal);
                }
                break;
            }
            return(null);
        }
Exemplo n.º 7
0
        protected virtual bool CheckAttackNode(MovesetAttackNode node)
        {
            if (node.attackDefinition == null)
            {
                return(false);
            }

            int currentOffset = 0;

            // Check execute button(s)
            bool pressedExecuteInputs = true;

            for (int e = 0; e < node.executeInputs.Count; e++)
            {
                switch (node.executeInputs[e].inputType)
                {
                case Input.InputDefinitionType.Stick:
                    if (!CheckStickDirection(node.executeInputs[e].stickDirection, node.executeInputs[e].directionDeviation, 0))
                    {
                        pressedExecuteInputs = false;
                        break;
                    }
                    break;

                case Input.InputDefinitionType.Button:
                    if (!controller.InputManager.GetButton(node.executeInputs[e].buttonID, out int gotOffset, 0, true, 3).firstPress)
                    {
                        pressedExecuteInputs = false;
                        break;
                    }
                    if (gotOffset < currentOffset)
                    {
                        currentOffset = gotOffset;
                    }
                    break;
                }
            }

            if (node.executeInputs.Count <= 0)
            {
                pressedExecuteInputs = false;
            }
            // We did not press the buttons required for this move.
            if (!pressedExecuteInputs)
            {
                return(false);
            }

            bool pressedSequenceButtons = true;

            for (int s = 0; s < node.inputSequence.Count; s++)
            {
                switch (node.inputSequence[s].inputType)
                {
                case Input.InputDefinitionType.Stick:
                    bool foundDir = false;
                    for (int f = currentOffset; f < currentOffset + 8; f++)
                    {
                        if (CheckStickDirection(node.inputSequence[s].stickDirection, node.inputSequence[s].directionDeviation, f))
                        {
                            foundDir      = true;
                            currentOffset = f;
                            break;
                        }
                    }
                    if (!foundDir)
                    {
                        pressedSequenceButtons = false;
                        break;
                    }
                    break;

                case Input.InputDefinitionType.Button:
                    break;
                }
                if (!pressedSequenceButtons)
                {
                    break;
                }
            }

            if (!pressedSequenceButtons)
            {
                return(false);
            }


            Cleanup();
            CurrentAttack = node;
            return(true);
        }
 public virtual void SetAttack(MovesetAttackNode attackNode)
 {
     Cleanup();
     CurrentAttack = attackNode;
 }