public void Execute(Player player) { Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.AddForce(10, 0, 0); if (!Input.GetKey(KeyCode.D)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } if (Input.GetKey(KeyCode.D) && Input.GetKey(KeyCode.W)) { MoveDiagonalRightForwardPlayerState movingForwardRight = new MoveDiagonalRightForwardPlayerState(); movingForwardRight.Enter(player); } if (Input.GetKey(KeyCode.D) && Input.GetKey(KeyCode.S)) { MoveDiagonalRightBackwardsPlayerState movingBackwardsRight = new MoveDiagonalRightBackwardsPlayerState(); movingBackwardsRight.Enter(player); } if (Input.GetKey(KeyCode.LeftShift)) { // transition to ducking DuckingPlayerState duckingState = new DuckingPlayerState(); duckingState.Enter(player); } if (Input.GetKey(KeyCode.Space) && player.onGround == true) { JumpingPlayerState jumpingState = new JumpingPlayerState(); jumpingState.Enter(player); } }
public void Execute(Player player) { if (player.onGround == true) { // transition to ducking StandingPlayerState standingState = new StandingPlayerState(); Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale = new Vector3(1, 1f, 1); standingState.Enter(player); } if (Input.GetKey(KeyCode.LeftShift)) { DivingPlayerState divingState = new DivingPlayerState(); divingState.Enter(player); } if (Input.GetKeyDown(KeyCode.Space)) { DoubleJumpPlayerState doubleJumpState = new DoubleJumpPlayerState(); doubleJumpState.Enter(player); } }
public void Execute(Player player) { if (!Input.GetKey(KeyCode.D)) { rbPlayer.transform.position = Vector3.MoveTowards(rbPlayer.position, new Vector3(0, .64f, 0), 3); StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } }
public void Execute(Player player) { if (Physics.Raycast(player.transform.position, Vector3.down, 1f)) { player.transform.localScale = Vector3.one; StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } }
public void Execute(Player player) { // If hit the ground if (Physics.Raycast(player.transform.position, Vector3.down, 0.55f)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } }
public void Execute(Player player) { if (!Input.GetKey(KeyCode.S)) { rbPlayer.transform.localScale *= 2.0f; StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } }
public void Execute(Player player) { if (!Input.GetKey(KeyCode.S)) { // transition to standing StandingPlayerState standingState = new StandingPlayerState(); Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale *= 2f; standingState.Enter(player); } }
public void Execute(Player player) { if (Physics.Raycast(player.transform.position, Vector3.down, 0.55f)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } if (Input.GetKeyDown(KeyCode.S)) { DivingPlayerState divingState = new DivingPlayerState(); divingState.Enter(player); } }
public void Execute(Client player) { if (Physics.Raycast(player.transform.position, Vector3.down, 0.55f)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector3 direction = new Vector3(horizontal, 0, vertical); player.transform.Translate(direction.normalized * Time.deltaTime * mforce, Space.World); }
public void Execute(Player player) { if (Physics.Raycast(rbPlayer.transform.position, Vector3.down, 0.55f)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } else if (Input.GetKeyDown(KeyCode.S)) { DuckingPlayerState duckState = new DuckingPlayerState(); rbPlayer.AddForce(0, -400 * Time.deltaTime, 0, ForceMode.VelocityChange); duckState.Enter(player); } }
public void Execute(Client player) { if (!Input.GetMouseButton(0)) { Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale *= 2f; StandingPlayerState StandingState = new StandingPlayerState(); StandingState.Enter(player); } float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector3 direction = new Vector3(horizontal, 0, vertical); player.transform.Translate(direction.normalized * Time.deltaTime * mforce, Space.World); }
public void Execute(Player player) { if (player.onGround == true) { if (Input.GetKeyDown(KeyCode.LeftShift)) { DuckingPlayerState duckingState = new DuckingPlayerState(); duckingState.Enter(player); } else { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } } }
public void Execute(Player player) { // If hit the ground if (Physics.Raycast(player.transform.position, Vector3.down, 0.55f)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } // If presses S to dive if (Input.GetKeyDown(KeyCode.S)) { // transition to diving DivingPlayerState divingState = new DivingPlayerState(); divingState.Enter(player); } }
public void Execute(Player player) { if (!Input.GetKey(KeyCode.LeftShift)) { // transition to ducking StandingPlayerState standingState = new StandingPlayerState(); Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale = new Vector3(1, 1f, 1); standingState.Enter(player); } if (Input.GetKey(KeyCode.Space)) { JumpingPlayerState jumpingState = new JumpingPlayerState(); Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale = new Vector3(1, 1f, 1); jumpingState.Enter(player); } }
public void Execute(Player player) { // If presses X to transform back if (Input.GetKeyDown(KeyCode.X)) { // transition to Standing player.GetComponent <MeshRenderer>().material = player.normal; StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } // If presses B explodes if (Input.GetKeyDown(KeyCode.B)) { // transition to PowerJump player.GetComponent <MeshRenderer>().material = player.burning; BurningPlayerState burningState = new BurningPlayerState(); burningState.Enter(player); } }
public void Execute(Client player) { if (!Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D) && !Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } if (Input.GetMouseButton(0)) { DuckingPlayerState DuckingState = new DuckingPlayerState(); DuckingState.Enter(player); } if (Input.GetKey(KeyCode.Space)) { JumpingPlayerState jumpingState = new JumpingPlayerState(); jumpingState.Enter(player); } float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector3 direction = new Vector3(horizontal, 0, vertical); player.transform.Translate(direction.normalized * Time.deltaTime * mforce, Space.World); }
public void Execute(Player player) { // If player releases s... if (!Input.GetKey(KeyCode.S)) { // transition to standing StandingPlayerState standingState = new StandingPlayerState(); Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale *= 2f; standingState.Enter(player); } // If presses space... if (Input.GetKeyDown(KeyCode.Space)) { // Power Jump Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.transform.localScale *= 2f; PowerJumpingPlayerState powerJumpingState = new PowerJumpingPlayerState(); powerJumpingState.Enter(player); } }
public void Execute(Player player) { Rigidbody rbPlayer = player.GetComponent <Rigidbody>(); rbPlayer.AddForce(-10, 0, 10); if (!Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.W)) { MoveForwardPlayerState movingForward = new MoveForwardPlayerState(); movingForward.Enter(player); } if (!Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.A)) { MoveLeftPlayerState movingLeft = new MoveLeftPlayerState(); movingLeft.Enter(player); } if (!Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.A)) { StandingPlayerState standingState = new StandingPlayerState(); standingState.Enter(player); } if (Input.GetKey(KeyCode.LeftShift)) { // transition to ducking DuckingPlayerState duckingState = new DuckingPlayerState(); duckingState.Enter(player); } if (Input.GetKey(KeyCode.Space) && player.onGround == true) { JumpingPlayerState jumpingState = new JumpingPlayerState(); jumpingState.Enter(player); } }
public override void InitStates() { base.InitStates(); standingState = Instantiate(standingState); runningState = Instantiate(runningState); aerialState = Instantiate(aerialState); perchedState = Instantiate(perchedState); wallJumpState = Instantiate(wallJumpState); stunnedState = Instantiate(stunnedState); knockedOutState = Instantiate(knockedOutState); chargeNormalAttack = Instantiate(chargeNormalAttack); chargeNormalAttack.InitStates(); /*chargeUpAttack = Instantiate(chargeUpAttack); * chargeUpAttack.InitStates();*/ chargeDownAttack = Instantiate(chargeDownAttack); chargeDownAttack.InitStates(); hitStunState = Instantiate(hitStunState); }