small fixes

This commit is contained in:
Vova
2023-12-17 12:23:13 +02:00
parent 19d57651c3
commit cf2dab57d9
3 changed files with 6 additions and 9 deletions
+2 -6
View File
@@ -28,15 +28,11 @@ public class SceneManager
if (spawn.name.ToLower() == _spawnLocationName.ToLower()) if (spawn.name.ToLower() == _spawnLocationName.ToLower())
{ {
var interactable = spawn.GetComponent<BaseInteractableObject>(); var interactable = spawn.GetComponent<BaseInteractableObject>();
Player.Instance.SetPosition(interactable._interactionPoint.position); Player.Instance.SetPosition(interactable._interactionPoint);
Player.Instance.Rotate(interactable._interactionPoint.forward * -1);
} }
} }
} }
else
{
Player.Instance.SetPosition(Vector3.zero);
}
GameManager.Instance.Camera.ResetToPlayerPosition(); GameManager.Instance.Camera.ResetToPlayerPosition();
} }
} }
+1 -1
View File
@@ -89,7 +89,7 @@ public abstract class BaseCharacter : MonoBehaviour
return false; return false;
} }
public TaskStatus Rotate(Vector3 target) protected TaskStatus Rotate(Vector3 target)
{ {
var targetRot = Quaternion.LookRotation(target); var targetRot = Quaternion.LookRotation(target);
Quaternion rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target), 10 * Time.deltaTime); Quaternion rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target), 10 * Time.deltaTime);
+3 -2
View File
@@ -51,10 +51,11 @@ public class Player : BaseCharacter
GameManager.Instance.Time.OnMinuteChanged -= UpdateStatsByClock; GameManager.Instance.Time.OnMinuteChanged -= UpdateStatsByClock;
} }
public void SetPosition(Vector3 desiredPosition) public void SetPosition(Transform desiredPosition)
{ {
_navAgent.Warp(desiredPosition); _navAgent.Warp(desiredPosition.position);
_navAgent.updatePosition = false; _navAgent.updatePosition = false;
Rotate(desiredPosition.forward * -1);
} }
public void GoToPoint(BaseInteractableObject point) public void GoToPoint(BaseInteractableObject point)