Example #1
0
        public override bool CheckCondition(StateManager state)
        {
            bool retval = false;

            if (inpManager.b_Input.isPressed)
            {
                bTimer += Time.deltaTime;
                if (bTimer > .5f)
                {
                    //sprint
                }
            }
            else
            {
                if (bTimer > 0)
                {
                    state.isBackstep = false;
                    retval           = true;
                    state.generalT   = 0;

                    if (state.moveAmount > 0)
                    {
                        state.anim.SetFloat("vertical", 1);
                        state.PlayAnimation("Rolls");
                        if (state.isLockingOn)
                        {
                            state.rollDirection = state.rotateDirection;
                        }
                        else
                        {
                            state.rollDirection = state.mTransform.forward;
                        }
                    }
                    else
                    {
                        //phan biet backstep va roll
                        state.isBackstep = true;
                        //xu li trong tree cua animation Roll, chu ko co anim stepback rieng
                        state.anim.SetFloat("vertical", 0);
                        state.PlayAnimation("Rolls");
                        state.rollDirection = -state.mTransform.forward;
                    }
                }
                bTimer = 0;
            }



            return(retval);
        }
Example #2
0
        public override void Execute(StateManager states)
        {
            if (states.isReloading)
            {
                if (!states.isInteracting)
                {
                    states.isInteracting = true;
                    states.PlayAnimation("Rifle Reload");
                    states.anim.SetBool("isInteracting", true);
                }
                else
                {
                    if (!states.anim.GetBool("isInteracting"))
                    {
                        states.isReloading   = false;
                        states.isInteracting = false;
                    }
                }
            }

            if (states.isShooting && !states.isReloading)
            {
                states.isShooting = false;

                Weapon w = states.inventory.currentWeapon;
                w.runtime.weaponHook.Shoot();
                states.animHook.RecoilAnim();
            }
        }
Example #3
0
 public override void Execute(StateManager stateManager)
 {
     if (stateManager.dontInterrupt)
     {
         return;
     }
     stateManager.dontInterrupt = true;
     stateManager.PlayAnimation("attack_interrupt");
 }
Example #4
0
 public override void Execute(StateManager s)
 {
     if (s.dontInterrupt)
     {
         return;
     }
     s.dontInterrupt = true;
     s.PlayAnimation("hit");
 }
Example #5
0
        public override void Execute(StateManager states)
        {
            states.PlayAnimation(targetAnim);
            states.currentState = targetState;

            if (assignCombo != null)
            {
                states.comboAction = assignCombo;
            }
        }
Example #6
0
 void PickupItem()
 {
     uiManager.OpenInteractCard(UIActionType.pickup);
     if (a_input)
     {
         Vector3 targetDir = states.pickManager.itemCandidate.transform.position - transform.position;
         states.SnapToRotation(targetDir);
         states.pickManager.PickCandidate(states);
         states.PlayAnimation("pick_up");
         a_input = false;
     }
 }
Example #7
0
        //right before casting spell
        // eg : walk => precast => spell
        public override void PrepareCast(StateManager state, Spell spell)
        {
            state.PlayAnimation(targetAnimation, false);
            //change state without wiring in graph
            state.currentState = castingSpellState;

            state.rigidbody.velocity    = Vector3.zero;
            state.rigidbody.isKinematic = true;
            state.forceEndActions       = true;

            CreateSpellParticle(spell, state.mTransform);
        }
Example #8
0
 public override void Execute(StateManager states)
 {
     if (states.inventory.spell != null)
     {
         states.inventory.spell.PrepareCast(states);
         states.currentState = targetState;
     }
     else
     {
         states.currentState = waitForAnimationState;
         states.PlayAnimation("cant spell", false);
     }
 }
        public override bool CheckCondition(StateManager states)
        {
            bool result = false;

            if (states.damageCollidersAreOpen)
            {
                if (!states.isStunned)
                {
                    result           = true;
                    states.isStunned = true;
                    states.PlayAnimation("attack_interrupt", false);
                }
            }
            return(result);
        }
Example #10
0
        public override void PrepareCast(StateManager state, Spell spell)
        {
            state.PlayAnimation(targetAnimation, false);
            //change state without wiring in graph
            state.currentState = castingSpellState;

            state.rigidbody.velocity    = Vector3.zero;
            state.rigidbody.isKinematic = true;
            state.forceEndActions       = true;
            state.currentProjectile     = spell.spellProjectile;

            Transform rh = state.anim.GetBoneTransform(HumanBodyBones.RightHand);

            CreateSpellParticle(spell, rh);
        }
        public override void Execute(StateManager states)
        {
            if (states.isReloading)
            {
                if (states.inventory.currentWeapon.currentBullets < states.inventory.currentWeapon.magazineBullets &&
                    states.inventory.currentWeapon.ammoType.carryingAmount > 0)
                {
                    if (!states.isInteracting)
                    {
                        states.reloadingFlag = true;
                        states.isInteracting = true;
                        states.PlayAnimation("Rifle Reload");
                        states.anim.SetBool("isInteracting", true);
                    }
                    else
                    {
                        if (!states.anim.GetBool("isInteracting"))
                        {
                            states.isReloading   = false;
                            states.isInteracting = false;
                            ReloadCurrentWeapon(states.inventory.currentWeapon);
                        }
                    }

                    return;
                }
                else
                {
                    states.isReloading = false;
                }
            }


            if (states.isShooting)
            {
                states.shootingFlag = true;
                states.isShooting   = false;
                Weapon w = states.inventory.currentWeapon;

                if (w.currentBullets > 0)
                {
                    if (Time.realtimeSinceStartup - w.runtime.weaponHook.lastFired > w.fireRate)
                    {
                        w.runtime.weaponHook.lastFired = Time.realtimeSinceStartup;
                        w.runtime.weaponHook.Shoot();
                        states.animHook.RecoilAnim();

                        if (!w.overrideBallistics)
                        {
                            if (states.ballisticsAction != null)
                            {
                                states.ballisticsAction.Execute(states, w);
                            }
                        }
                        else
                        {
                            w.ballistics.Execute(states, w);
                        }


                        w.currentBullets--;
                        if (w.currentBullets < 0)
                        {
                            w.currentBullets = 0;
                        }
                    }
                }
                else
                {
                    states.isReloading = true;
                }
            }
        }
Example #12
0
        public override void Execute(StateManager states)
        {
            if (states.isTwoHanded)
            {
                TwoHandedAction(states);
                return;
            }
            ItemActions targetAction = null;
            bool        isMirror     = false;

            switch (inpButtonVariable.value)
            {
            case StateManager.InputButton.rb:
            case StateManager.InputButton.rt:
                if (isParryEnemy)
                {
                    bool success = isParryEnemy.CheckCondition(states);
                    if (success)
                    {
                        states.PlayAnimation("parry_attack", false);
                        return;
                    }
                }
                if (states.inventory.rightHandWeapon != states.inventory.unarmedWeapon)
                {
                    isMirror     = false;
                    targetAction = states.inventory.rightHandWeapon.GetItemActions(inpButtonVariable.value);
                }
                else
                {
                    if (states.inventory.leftHandWeapon != states.inventory.unarmedWeapon)
                    {
                        //rb +2 = lb
                        isMirror = true;
                        StateManager.InputButton newButton = (StateManager.InputButton)((int)inpButtonVariable.value + 2);
                        targetAction = states.inventory.rightHandWeapon.GetItemActions(newButton);
                    }
                    else
                    {
                        isMirror     = false;
                        targetAction = states.inventory.rightHandWeapon.GetItemActions(inpButtonVariable.value);
                    }
                }

                break;

            case StateManager.InputButton.lb:
            case StateManager.InputButton.lt:

                if (states.inventory.leftHandWeapon == states.inventory.unarmedWeapon)
                {
                    targetAction = states.inventory.rightHandWeapon.GetItemActions(inpButtonVariable.value);
                    isMirror     = false;
                }
                else
                {
                    if (!powerPosing)
                    {
                        //turn lb,lt input to rb,rt input
                        StateManager.InputButton newButton = (StateManager.InputButton)((int)inpButtonVariable.value - 2);
                        isMirror     = true;
                        targetAction = states.inventory.leftHandWeapon.GetItemActions(newButton);
                    }
                    else
                    {
                        isMirror     = true;
                        targetAction = states.inventory.rightHandWeapon.GetItemActions(inpButtonVariable.value);
                    }
                }
                break;

            default:
                break;
            }

            states.inventory.currentItemAction = targetAction;

            states.anim.SetBool("mirror", isMirror);
            if (targetAction != null)
            {
                targetAction.Execute(states);
            }
        }