예제 #1
0
 void Start()
 {
     RequestForMovement(CellDirection.N);
     RequestForMovement(CellDirection.S);
     RequestForMovement(CellDirection.E);
     RequestForMovement(CellDirection.W);
     CellsManager.UpdateVisibility(currentCell, visibilityRange);
     CanMove = true;
 }
예제 #2
0
    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);
    }
예제 #3
0
    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;
    }
예제 #4
0
 void Awake()
 {
     instance = this;
 }
예제 #5
0
 private void Awake()
 {
     s_singleton = this;
 }