Esempio n. 1
0
//moves the player down and changes his stamina
void Player::MoveDown()
{
	if (Stamina > 0)
	{
		ChangeStamina(-1);
	}
	else
	{
		ChangeHealth(-2);
	}
	yLocation++;
}
Esempio n. 2
0
//moves the player up and changes his stamina
void Player::MoveUp()
{
	if (Stamina > 0)
	{
		ChangeStamina(-1);
	}
	else
	{
		ChangeHealth(-2);
	}
	yLocation--;
}
Esempio n. 3
0
//moves the player right and changes his stamina
void Player::MoveRight()
{
	if (Stamina > 0)
	{
		ChangeStamina(-1);
	}
	else
	{
		ChangeHealth(-2);
	}
	xLocation++;
}
Esempio n. 4
0
//uses Gatorade to restore the player's stamina
string Player::Drink()
{
	if (Gatorade == 0)
	{
		return "You're out of Gatorade!";
	}
	else
	{
		Gatorade--;
		ChangeStamina(15);
		return "Your stamina has been restored!";
	}
}
void ARoguelikeChar::CharacterJump()
{
	if (bIsDead)return;

	if (bIsAiming || PlayerAnimationInstance->bIsReloading)
		return;

	if (bIsSprinting && !PlayerAnimationInstance->bHasJumped)
	{
		ChangeStamina(-20);
	}

	Jump();
	PlayerAnimationInstance->bHasJumped = true;
}
void ARoguelikeChar::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if (bIsDead)
	{
		DeathCameraMovement(DeltaTime);
	}
	else
	{

		PlayerCamera->PostProcessSettings.SceneColorTint = FLinearColor(1.f, CurrentHealth / MaxHealth, CurrentHealth / MaxHealth);

		// Reset Jump Check
		if (PlayerAnimationInstance->bHasJumped)
		{
			PlayerAnimationInstance->bIsGrounded = GetCharacterMovement()->IsMovingOnGround();
			if (PlayerAnimationInstance->bIsGrounded)PlayerAnimationInstance->bHasJumped = false;
		}

		// Aiming Mechanic
		if (bIsAiming)
		{
			if (PlayerCamera->FieldOfView > FOVLowLimit)
			{
				PlayerCamera->FieldOfView -= FOVDropRate * DeltaTime;
			}
		}
		else
		{
			if (PlayerCamera->FieldOfView < FOVHighLimit)
			{
				PlayerCamera->FieldOfView += FOVDropRate * DeltaTime;
			}
		}

		// Sprinting Mechanics
		ChangeStamina(StaminaRate * DeltaTime);


		// Laser-Specific Code
		if (bIsAiming)
			GenerateLaserBeam();


	}
}
Esempio n. 7
0
//restores the player's health and stamina when he sleeps in a bed
void Player::Sleep()
{
	ChangeHealth(40);
	ChangeStamina(20);
}