if (controller.MoveDirection != Vector3.zero)
{
controller.Move(controller.targetDirection, speed);
transform.rotation = Quaternion.LookRotation(controller.targetDirection);
}
if (!controller.isGrounded()) {
state=State.InAir;
}
if (jumpBuffer > 0)
{Jump();}
if (controller.MoveDirection != Vector3.zero)
{
controller.Move(controller.targetDirection, KoiranNopeus);
transform.rotation = Quaternion.LookRotation(controller.targetDirection);
}
if (!controller.isGrounded())
{
state = State.InAir;
}
if (jumpBuffer > 0)
{
Jump();
}
a = b + c;
, not a=b+c;
{
braces:if (true) {
...
}
orif (true)
{
...
}
if (controller.MoveDirection != Vector3.zero && !controller.isGrounded() && jumpBuffer > 0)
toif (controller.MoveDirection != Vector3.zero
&& !controller.isGrounded()
&& jumpBuffer > 0)
if (controller.MoveDirection != Vector3.zero
&& !controller.isGrounded()
&& jumpBuffer > 0)
const bool notMoving = controller.MoveDirection != Vector3.zero;
const bool onAir = !controller.isGrounded();
const bool canJump = jumpBuffer > 0;
if (notMoving && onAir && canJump)
// set player state to grounded when player touches the ground
if (collider.tag == "Ground")
{
const state = State.Grounded;
}
// give a random rotation between 0 and 180
const rotation = Quaternion.Euler(0, Random.Range(0, 180), 0);
public static Quaternion RandomRotationRange(float angle1, float angle2)
{
return Quaternion.Euler(0, Random.Range(angle1, angle2), 0);
}
a) it gives the same information you wanted to givea = b * c;
weeklyPay = hoursWorked * hourlyPayRate;
pAttack
, attackLandProbability
, player1HitPercentage
...
playerAttackToLandProbabilityAsPercentage
pAtk
rotationsPerDay = rotationsPerSecond * 60 * 60 * 24;
secondsPerDay = 60 * 60 * 24;
rotationsPerDay = rotationsPerSecond * secondsPerDay;
Jump
and Idle
.if (state == PlayerState.Jump)
{
JumpAnimation.Play();
} else {
IdleAnimation.Play();
}
Swim
state in the future?else
block has to be refactored!if (state == PlayerState.Jump)
{
JumpAnimation.Play();
}
else if (state == PlayerState.Idle)
{
IdleAnimation.Play();
}
int spr_smallhop = 993,
bool drwOnAbove = true;
int[] shinypals = [ 1, 4, 2 ];
snake_case
camelCase
flatcase