// Update is called once per frame /// <summary> /// This function changes the position of the object the script is added to, when the moving controls (e.g.: W-A-S-D) are used /// </summary> void Update() { if (EventSystem.current.IsPointerOverGameObject()) { return; } Vector2 curentPosition = rigidbody.position; SwitchMovementType(); rigidbody.MovePosition(movementService.CalculateNewPosition(curentPosition, movementSpeed, false)); }
// Update is called once per frame /// <summary> /// Changes the position of the player character, when the moving controls (e.g.: W-A-S-D) are used /// </summary> void Update() { Vector2 curentPosition = rigidbody.position; rigidbody.MovePosition(movementService.CalculateNewPosition(curentPosition, movementSpeed, enteredCollision)); }
/// <summary> /// Stops chasing the player /// </summary> private void StopChasingPlayer() { Vector2 curentPosition = rigidbody.position; rigidbody.MovePosition(movementService.CalculateNewPosition(curentPosition, 0, false, possibleDirectionX, possibleDirectionY)); }