예제 #1
0
 public virtual void Die()
 {
     if (PlayerDieEvent != null)
     {
         PlayerDieEvent.Invoke();
     }
 }
예제 #2
0
 public override void Kill()
 {
     if (Killed)
     {
         return;
     }
     Killed = true;
     PlayerDieEvent?.Invoke();
     Life--;
     base.Kill();
 }
예제 #3
0
    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();
        }
    }