Ejemplo n.º 1
0
 public override void Execute(StateManager states)
 {
     states.playerLight.canSwitchtoDoubleJumpState = false;
     states.playerLight.wallJumpConfig.direction   = new Vector2(states.movementValues.moveDirection.x * -1, states.movementValues.vertical);
 }
Ejemplo n.º 2
0
 public void Init()
 {
     stateManagerObject        = Instantiate(stateManagerPrefab) as GameObject;
     stateManager              = stateManagerObject.GetComponent <StateManager>();
     stateManager.playerHolder = this; //tell the state manager which player's turn it is at the styart of the game (two way reflection?)
 }
Ejemplo n.º 3
0
        public Action GetActionSlot(StateManager st)
        {
            ActionInput a_input = GetActionInput(st);

            return(GetActionEntry(a_input));
        }
Ejemplo n.º 4
0
 public override void Execute(StateManager states)
 {
     Jump(states);
 }
Ejemplo n.º 5
0
 public override bool CheckCondition(StateManager state)
 {
     return(state.IsAtDestination == HasArrived);
 }
Ejemplo n.º 6
0
 public override bool CheckCondition(StateManager state)
 {
     return(state.IdleTimer > state.WaitTime);
 }
Ejemplo n.º 7
0
 public abstract void PrepareCast(StateManager state, Spell spell);
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
0
 public override void Execute(StateManager state)
 {
     state.anim.SetFloat("moving", 0);
     state.anim.SetBool("dash", false);
     state.anim.SetBool("attackPrimary", true);
 }
Ejemplo n.º 10
0
 public override void Execute(StateManager states)
 {
     states.IsAtDestination = true;
 }
Ejemplo n.º 11
0
 private void Start()
 {
     this.gameObject.layer = 10;
     collider  = GetComponent <Collider>();
     ourStates = GetComponentInParent <StateManager>();
 }
Ejemplo n.º 12
0
 public void Set(StateManager s)
 {
     value = s;
 }
Ejemplo n.º 13
0
 public override void Execute(StateManager states)
 {
     states.anim.SetBool(targetBool, status);
 }
Ejemplo n.º 14
0
 public void InitPlayer(StateManager st)
 {
     states = st;
 }
Ejemplo n.º 15
0
 private void FlipDirection(StateManager states)
 {
     direction = states.coll.collisions.faceDir * -1;
 }
Ejemplo n.º 16
0
 public void PrepareCast(StateManager states)
 {
     spellAction.PrepareCast(states, this);
     SetSpellToCast(states);
 }
Ejemplo n.º 17
0
 private void Patrol(StateManager controller)
 {
     command.Execute(controller.gameObject);
 }
Ejemplo n.º 18
0
 public void SetSpellToCast(StateManager states)
 {
     states.currentSpell = this;
 }
Ejemplo n.º 19
0
 //state to know who cast the spell
 public abstract bool Cast(StateManager state, Spell spell);
Ejemplo n.º 20
0
 public void Init(StateManager st)
 {
     states    = st;
     anim      = st.anim;
     rollCurve = st.roll_curve;
 }
Ejemplo n.º 21
0
 public override void Execute(StateManager states)
 {
     attackCom.Execute(states.gameObject);
 }
Ejemplo n.º 22
0
 public abstract bool CheckCondition(StateManager state);
 public void Init(StateManager st)
 {
     states = st;
     anim = st.anim;
 }
        public override void Execute(StateManager states)
        {
            float      frontY = 0;
            RaycastHit hit;
            Vector3    origin = states.mTransform.position + (states.mTransform.forward * frontRayOffset);

            origin.y += 0.5f;
            Debug.DrawRay(origin, -Vector3.up, Color.red, 0.1f, false);
            if (Physics.Raycast(origin, -Vector3.up, out hit, 1, states.ignoreLayers))
            {
                float y = hit.point.y;
                frontY = y - states.mTransform.position.y;
            }

            Vector3 currentVelocity = states.rigidbody.velocity;

            if (states.isSprinting)
            {
                targetVelocity = states.mTransform.forward * states.movementValues.moveAmount * sprintSpeed;
            }
            else if (states.isCrouching)
            {
                targetVelocity = states.mTransform.forward * states.movementValues.moveAmount * crouchSpeed;
            }
            else
            {
                targetVelocity = states.mTransform.forward * states.movementValues.moveAmount * movementSpeed;
            }

            if (states.isGrounded)
            {
                float moveAmount = states.movementValues.moveAmount;

                if (moveAmount > 0.1f)
                {
                    states.rigidbody.isKinematic = false;
                    states.rigidbody.drag        = 0;
                    if (Mathf.Abs(frontY) > 0.02f)
                    {
                        targetVelocity.y = ((frontY > 0) ? frontY + 0.2f : frontY) * movementSpeed;
                    }
                }
                else
                {
                    float abs = Mathf.Abs(frontY);
                    if (abs > 0.02f)
                    {
                        states.rigidbody.isKinematic = false;
                        targetVelocity.y             = 0;
                        states.rigidbody.drag        = 4;
                    }
                }
            }
            else
            {
                states.rigidbody.isKinematic = false;
                states.rigidbody.drag        = 0;
                targetVelocity.y             = currentVelocity.y;
            }

            Debug.DrawRay((states.mTransform.position + Vector3.up * 0.2f), targetVelocity, Color.green, 0.01f, false);
            states.rigidbody.velocity = Vector3.Lerp(currentVelocity, targetVelocity, states.delta * adaptSpeed);
        }
Ejemplo n.º 25
0
 public abstract void Execute(StateManager states);
Ejemplo n.º 26
0
 public abstract void Execute(StateManager states, Weapon w);
Ejemplo n.º 27
0
 public void Init(StateManager st)
 {
     states = st;
     UpdateActionsOneHanded();
 }
Ejemplo n.º 28
0
 public override void Execute(StateManager states)
 {
     CheckDirection(states);
     command = direction == 1 ? (ICommand)rightCom : (ICommand)leftCom;
     Patrol(states);
 }
Ejemplo n.º 29
0
 public override bool CheckCondition(StateManager state)
 {
     return(state.health <= 0);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Executes in-game actions
 /// </summary>
 /// <param name="sm"> The Session Manager</param>
 public abstract void Execute(StateManager states, SessionManager sm, Turn t);