Beispiel #1
0
        protected override void _StartAction(RPGCharacterController controller, AttackContext context)
        {
            int   attackSide   = 0;
            int   attackNumber = context.number;
            int   weaponNumber = controller.rightWeapon;
            float duration     = 0f;

            if (context.side == (int)AttackSide.Right && AnimationData.Is2HandedWeapon(weaponNumber))
            {
                context.side = (int)AttackSide.None;
            }

            switch (context.side)
            {
            case (int)AttackSide.None:
                attackSide   = 0;
                weaponNumber = controller.rightWeapon;
                break;

            case (int)AttackSide.Left:
                attackSide   = 1;
                weaponNumber = controller.leftWeapon;
                break;

            case (int)AttackSide.Right:
                attackSide   = 2;
                weaponNumber = controller.rightWeapon;
                break;
            }

            if (attackNumber == -1)
            {
                switch (context.type)
                {
                case "Attack":
                    attackNumber = AnimationData.RandomAttackNumber(attackSide, weaponNumber);
                    break;

                case "Kick":
                    attackNumber = AnimationData.RandomKickNumber(attackSide);
                    break;
                }
            }

            duration = AnimationData.AttackDuration(attackSide, weaponNumber, attackNumber);

            if (controller.isMoving)
            {
                controller.RunningAttack(
                    attackSide,
                    controller.hasLeftWeapon,
                    controller.hasRightWeapon,
                    controller.hasTwoHandedWeapon
                    );
                EndAction(controller);
            }
            else if (context.type == "Attack")
            {
                controller.Attack(
                    attackNumber,
                    controller.leftWeapon,
                    controller.rightWeapon,
                    duration
                    );
                EndAction(controller);
            }
        }