示例#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);
 }
示例#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?)
 }
示例#3
0
        public Action GetActionSlot(StateManager st)
        {
            ActionInput a_input = GetActionInput(st);

            return(GetActionEntry(a_input));
        }
示例#4
0
 public override void Execute(StateManager states)
 {
     Jump(states);
 }
 public override bool CheckCondition(StateManager state)
 {
     return(state.IsAtDestination == HasArrived);
 }
示例#6
0
 public override bool CheckCondition(StateManager state)
 {
     return(state.IdleTimer > state.WaitTime);
 }
示例#7
0
 public abstract void PrepareCast(StateManager state, Spell spell);
示例#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);
            }
        }
示例#9
0
 public override void Execute(StateManager state)
 {
     state.anim.SetFloat("moving", 0);
     state.anim.SetBool("dash", false);
     state.anim.SetBool("attackPrimary", true);
 }
示例#10
0
 public override void Execute(StateManager states)
 {
     states.IsAtDestination = true;
 }
示例#11
0
 private void Start()
 {
     this.gameObject.layer = 10;
     collider  = GetComponent <Collider>();
     ourStates = GetComponentInParent <StateManager>();
 }
示例#12
0
 public void Set(StateManager s)
 {
     value = s;
 }
示例#13
0
 public override void Execute(StateManager states)
 {
     states.anim.SetBool(targetBool, status);
 }
示例#14
0
 public void InitPlayer(StateManager st)
 {
     states = st;
 }
示例#15
0
 private void FlipDirection(StateManager states)
 {
     direction = states.coll.collisions.faceDir * -1;
 }
示例#16
0
文件: Spell.cs 项目: Chinhlq96/Souls
 public void PrepareCast(StateManager states)
 {
     spellAction.PrepareCast(states, this);
     SetSpellToCast(states);
 }
示例#17
0
 private void Patrol(StateManager controller)
 {
     command.Execute(controller.gameObject);
 }
示例#18
0
文件: Spell.cs 项目: Chinhlq96/Souls
 public void SetSpellToCast(StateManager states)
 {
     states.currentSpell = this;
 }
示例#19
0
 //state to know who cast the spell
 public abstract bool Cast(StateManager state, Spell spell);
示例#20
0
 public void Init(StateManager st)
 {
     states    = st;
     anim      = st.anim;
     rollCurve = st.roll_curve;
 }
示例#21
0
 public override void Execute(StateManager states)
 {
     attackCom.Execute(states.gameObject);
 }
示例#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);
        }
示例#25
0
 public abstract void Execute(StateManager states);
示例#26
0
 public abstract void Execute(StateManager states, Weapon w);
示例#27
0
 public void Init(StateManager st)
 {
     states = st;
     UpdateActionsOneHanded();
 }
示例#28
0
 public override void Execute(StateManager states)
 {
     CheckDirection(states);
     command = direction == 1 ? (ICommand)rightCom : (ICommand)leftCom;
     Patrol(states);
 }
示例#29
0
 public override bool CheckCondition(StateManager state)
 {
     return(state.health <= 0);
 }
示例#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);