public void RespawnPlayer() { playerDead = 0.3f; movement.x = 0; movement.y = 0; direction = SwipeDirection.None; transform.position = new Vector3(0, -11, 0); XonixUtils.UpdateAnimator(animator, direction); }
private void FixedUpdate() { if (CanMove()) { transform.position = (transform.position + movement * moveSpeed * Time.fixedDeltaTime); } else { UpdateMovement(); XonixUtils.UpdateAnimator(animator, direction); } if (!TryAtackPlayer()) { TryAtackPlayerTrack(); } }
private void UpdateDirection(SwipeDirection swipeDirection) { if (GameController.isPause) { return; } if (IsDirectionConflict(swipeDirection)) { movement.x = 0; movement.y = 0; direction = SwipeDirection.None; // Decrement player health OnPlayerDamaged(); } else { movement.x = 0; movement.y = 0; direction = swipeDirection; switch (direction) { case SwipeDirection.Up: movement.y = 1; break; case SwipeDirection.Down: movement.y = -1; break; case SwipeDirection.Left: movement.x = -1; break; case SwipeDirection.Right: movement.x = 1; break; } } XonixUtils.UpdateAnimator(animator, direction); }