public override void Step(CharControlMotor player, float deltaTime) { player.UpdateDirection(player.input.horizontal); player.HandleSlopeFactor(deltaTime); player.HandleAcceleration(deltaTime); player.HandleFriction(deltaTime); player.HandleGravity(deltaTime); player.HandleFall(); if (!player.HandleLedgeCheck().Item2) { player.state.ChangeState <WalkPlayerState>(); } if (player.input.actionDown) { player.HandleJump(); } if (player.HandleLedgeCheck().Item1) { player.state.ChangeState <LedgeGrabStateFront>(); } if (player.input.horizontal != 0 || player.velocity.x != 0) { player.state.ChangeState <WalkPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleGravity(deltaTime); player.HandleFall(); power -= ((power / player.stats.SpinpowerLoss) / 256f) * deltaTime; if (player.grounded) { if (player.input.down) { if (player.input.actionDown) { player.sonicState = CharControlMotor.SonicState.ChargingSpin; power += player.stats.SpinchargePower; power = Mathf.Min(power, player.stats.SpinmaxChargePower); player.PlayAudio(player.audios.spindash_charge, 0.5f); } } else { player.state.ChangeState <RollPlayerState>(); } } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleGravity(deltaTime); if (player.grounded) { player.velocity.x = 0; player.state.ChangeState <WalkPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleAcceleration(deltaTime); player.HandleGravity(deltaTime); if (player.velocity.y <= 0) { player.state.ChangeState <WalkPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleSlopeFactor(deltaTime); player.HandleFriction(deltaTime); player.HandleDeceleration(deltaTime); player.HandleGravity(deltaTime); player.HandleFall(); ///* Controls the height of the playerspin ~Birb64 */// if (player.PlayerObject.transform.eulerAngles.z > 100 && player.PlayerObject.transform.eulerAngles.z < 180) { player.PlayerObject.GetComponent <PlayerMotor>().height = 0.012f * player.PlayerObject.transform.eulerAngles.z; } if (player.PlayerObject.transform.eulerAngles.z < 260 && player.PlayerObject.transform.eulerAngles.z > 180) { player.PlayerObject.GetComponent <PlayerMotor>().height = 0.012f * (180 - Mathf.Abs(player.PlayerObject.transform.eulerAngles.z - 180)); } ///* Controls the width of the playerspin ~Birb64 */// if (player.PlayerObject.transform.eulerAngles.z > 30 && player.PlayerObject.transform.eulerAngles.z < 180) { player.PlayerObject.GetComponent <PlayerMotor>().wallExtents = 0.01f * player.PlayerObject.transform.eulerAngles.z; } if (player.PlayerObject.transform.eulerAngles.z < 330 && player.PlayerObject.transform.eulerAngles.z > 180) { player.PlayerObject.GetComponent <PlayerMotor>().wallExtents = 0.01f * (180 - Mathf.Abs(player.PlayerObject.transform.eulerAngles.z - 180)); } else if (player.PlayerObject.transform.eulerAngles.z < 180 || player.PlayerObject.transform.eulerAngles.z > 260) { player.PlayerObject.GetComponent <PlayerMotor>().wallExtents = 0.02f; } if (player.grounded) { if (player.input.actionDown) { player.HandleJump(); } else if (Mathf.Abs(player.velocity.x) < player.stats.minSpeedToUnroll) { player.state.ChangeState <WalkPlayerState>(); } } else { player.state.ChangeState <JumpPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleGravity(deltaTime); player.HandleFall(); if (player.grounded && player.input.down) { if (player.input.actionDown) { player.state.ChangeState <SpindashPlayerState>(); } } else { player.state.ChangeState <WalkPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.UpdateDirection(player.input.horizontal); player.HandleAcceleration(deltaTime); player.HandleGravity(deltaTime); if (!player.grounded && player.attacking) { if (player.input.actionUp && player.velocity.y > player.stats.minJumpHeight) { player.velocity.y = player.stats.minJumpHeight; } } else { player.state.ChangeState <WalkPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleGravity(deltaTime); player.HandleFall(); chargeAmount += Time.deltaTime * chargeSpeed; power -= ((power / player.stats.PeelpowerLoss) / 256f) * deltaTime; if (player.grounded) { if (player.input.up) { if (player.input.actionDown) { player.sonicState = CharControlMotor.SonicState.ChargingPeel; power += player.stats.PeelchargePower; power = Mathf.Min(power, player.stats.PeelmaxChargePower); //player.PlayAudio(player.audios.peel, 0.5f); } } else if (player.input.down) { if (Mathf.Abs(player.velocity.x) > player.stats.minSpeedToRoll) { player.sonicState = CharControlMotor.SonicState.Rolling; player.state.ChangeState <RollPlayerState>(); //player.PlayAudio(player.audios.spin, 0.5f); } else if (player.angle < player.stats.minAngleToSlide) { player.state.ChangeState <CrouchPlayerState>(); } } else { player.state.ChangeState <WalkPlayerState>(); } } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleDeceleration(deltaTime); player.HandleGravity(deltaTime); player.HandleFall(); if (player.grounded && (Mathf.Sign(player.input.horizontal) != Mathf.Sign(player.direction))) { if (player.input.actionDown) { player.HandleJump(); } else if ((Mathf.Abs(player.velocity.x) <= player.stats.turnSpeed) || player.input.horizontal == 0) { player.state.ChangeState <WalkPlayerState>(); } } else { player.state.ChangeState <WalkPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleSlopeFactor(deltaTime); player.HandleFriction(deltaTime); player.HandleDeceleration(deltaTime); player.HandleGravity(deltaTime); player.HandleFall(); if (player.grounded) { if (player.input.actionDown) { player.HandleJump(); } else if (Mathf.Abs(player.velocity.x) < player.stats.minSpeedToUnroll) { player.state.ChangeState <WalkPlayerState>(); } } else { player.state.ChangeState <JumpPlayerState>(); } }
public override void Step(CharControlMotor player, float deltaTime) { player.UpdateDirection(player.input.horizontal); player.HandleAcceleration(deltaTime); player.HandleGravity(deltaTime); if (!player.grounded && player.attacking) { if (player.input.actionUp && player.velocity.y > player.stats.minJumpHeight) { player.velocity.y = player.stats.minJumpHeight; } if (dashTimer > maxDashAmount) { dashTimer = maxDashAmount; } if (active) { if (Input.GetKeyDown(DifferentKeysForJump[0]) || Input.GetKeyDown(DifferentKeysForJump[1])) //Add more if needed { player.PlayAudio(player.audios.spindash_charge, 0.5f); charging = true; } if (charging) { dashTimer += Time.deltaTime * chargeSpeed; dashSpeed.x = dashTimer; if (Input.GetKey(DifferentKeysForJump[0]) || Input.GetKey(DifferentKeysForJump[1])) { codedDashSpeed = dashSpeed; player.PlayAudio(player.audios.peel_launch, 0.5f); if (player.input.left) { codedDashSpeed -= codedDashSpeed * 2; } else if (player.input.right) { codedDashSpeed = dashSpeed; } else { if (player.velocity.x < 0) { codedDashSpeed = codedDashSpeed - codedDashSpeed * 2; } else if (player.velocity.x > 0) { codedDashSpeed = dashSpeed; } } active = false; player.velocity = dashTarget.position - transform.position + codedDashSpeed; } } } else if ((Input.GetKeyUp(DifferentKeysForJump[0]) || Input.GetKeyUp(DifferentKeysForJump[1])) && !charging) { active = true; } } else { player.state.ChangeState <WalkPlayerState>(); player.skin.animator.SetInteger("Charge", 0); } }
public override void Step(CharControlMotor player, float deltaTime) { player.UpdateDirection(player.input.horizontal); player.HandleSlopeFactor(deltaTime); player.HandleAcceleration(deltaTime); player.HandleFriction(deltaTime); player.HandleGravity(deltaTime); player.HandleFall(); if (player.grounded) { if (player.input.actionDown) { player.HandleJump(); } else if (player.input.down) { if (Mathf.Abs(player.velocity.x) > player.stats.minSpeedToRoll) { player.sonicState = CharControlMotor.SonicState.Rolling; player.state.ChangeState <RollPlayerState>(); //player.PlayAudio(player.audios.spin, 0.5f); } else if (player.angle < player.stats.minAngleToSlide) { player.state.ChangeState <CrouchPlayerState>(); } } else if (player.input.up) { // Changing this condition because it causes animation bugs - Arcy //if (Mathf.Abs(player.velocity.x) < player.stats.minSpeedToRoll) if (player.velocity.x == 0) { player.state.ChangeState <LookUpPlayerState>(); } } else if (Mathf.Sign(player.velocity.x) != Mathf.Sign(player.input.horizontal) && player.input.horizontal != 0) { if (Mathf.Abs(player.velocity.x) >= player.stats.minSpeedToBrake) { player.state.ChangeState <BrakePlayerState>(); } else { if (player.velocity.x > 0) { player.velocity.x = -player.stats.turnSpeed; } else { player.velocity.x = player.stats.turnSpeed; } } } else if (player.HandleLedgeCheck().Item1) { player.state.ChangeState <LedgeGrabStateFront>(); } else if (player.HandleLedgeCheck().Item2) { player.state.ChangeState <LedgeGrabStateBack>(); } else if (player.HandlePushCheck().Item1&& Mathf.Abs(player.input.horizontal) > 0) { player.state.ChangeState <PushPlayerState>(); } } }
public override void Step(CharControlMotor player, float deltaTime) { player.HandleGravity(deltaTime); }