public virtual void Die() { if (PlayerDieEvent != null) { PlayerDieEvent.Invoke(); } }
public override void Kill() { if (Killed) { return; } Killed = true; PlayerDieEvent?.Invoke(); Life--; base.Kill(); }
private void Update() { Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); if (joystick.Horizontal != 0 || joystick.Vertical != 0) { moveInput = new Vector2(joystick.Horizontal, joystick.Vertical); } moveVelocity = moveInput.normalized * speed; if (health <= 0) { PlayerDieEvent.Invoke(); } }