basically the whole game
This commit is contained in:
parent
949135cecb
commit
96dcfa9064
315 changed files with 34386 additions and 396 deletions
|
|
@ -4,24 +4,55 @@ using UnityEngine;
|
|||
|
||||
public class Player : Entity
|
||||
{
|
||||
[Header("Invulnerability")]
|
||||
[SerializeField] private float invulnerabilityLength;
|
||||
private float currentInvulnerabilityTime;
|
||||
[Header("UI")]
|
||||
[SerializeField] private TextMeshProUGUI livesText;
|
||||
|
||||
[Header("SFX")]
|
||||
[SerializeField] private AudioClip hurtSound;
|
||||
[SerializeField] private float hurtVolume = 1f;
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
if (!isStalled)
|
||||
{
|
||||
abilities[0].TryAbility();
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
abilities[0].TryAbility();
|
||||
}
|
||||
if (Input.GetMouseButtonDown(1)) //this way kinda sucks but i'll fix it when i feel like it
|
||||
{
|
||||
abilities[1].TryAbility();
|
||||
}
|
||||
}
|
||||
if (Input.GetMouseButtonDown(1)) //this way kinda sucks but i'll fix it when i feel like it
|
||||
|
||||
if (currentInvulnerabilityTime > 0)
|
||||
{
|
||||
abilities[1].TryAbility();
|
||||
currentInvulnerabilityTime -= Time.deltaTime;
|
||||
if (currentInvulnerabilityTime <= 0)
|
||||
{
|
||||
invulnerable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void TakeDamage(int damage)
|
||||
{
|
||||
base.TakeDamage(damage);
|
||||
if (!invulnerable)
|
||||
{
|
||||
WaveManager.instance.audioSource.PlayOneShot(hurtSound, hurtVolume);
|
||||
currentInvulnerabilityTime = invulnerabilityLength;
|
||||
invulnerable = true;
|
||||
}
|
||||
UpdateLivesUI();
|
||||
GameManager.instance.livesLost++;
|
||||
}
|
||||
|
||||
protected override void OnDeath()
|
||||
{
|
||||
GameManager.instance.LoseGame();
|
||||
}
|
||||
private void UpdateLivesUI()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue