void Start() { RequestForMovement(CellDirection.N); RequestForMovement(CellDirection.S); RequestForMovement(CellDirection.E); RequestForMovement(CellDirection.W); CellsManager.UpdateVisibility(currentCell, visibilityRange); CanMove = true; }
public CellManager GetOrSetNeighbor(CellDirection cellDirection) { var cellManager = GetNeighbor(cellDirection); if (cellManager == null) { cellManager = CellsManager.GetNeighbor(this, cellDirection); if (cellManager != null) { SetNeighbor(cellManager, cellDirection); } } return(cellManager); }
IEnumerator MoveToPosition(Transform destination) { var currentPos = playerTransform.position; var destinationPos = destination.position; var currentRot = playerTransform.rotation; var destinationRot = Quaternion.LookRotation(playerTransform.position - destination.position); var t = 0f; while (t < 1) { t += Time.deltaTime / secondsToMove; playerTransform.position = Vector3.Lerp(currentPos, destinationPos, t); playerTransform.rotation = Quaternion.Slerp(currentRot, destinationRot, t); yield return(null); } RequestForMovement(CellDirection.N); RequestForMovement(CellDirection.S); RequestForMovement(CellDirection.E); RequestForMovement(CellDirection.W); CellsManager.UpdateVisibility(currentCell, visibilityRange); playerAnimator.SetBool(boolIsMoving.name, false); CanMove = true; }
void Awake() { instance = this; }
private void Awake() { s_singleton = this; }