Ejemplo n.º 1
0
 void Start()
 {
     RequestForMovement(CellDirection.N);
     RequestForMovement(CellDirection.S);
     RequestForMovement(CellDirection.E);
     RequestForMovement(CellDirection.W);
     CellsManager.UpdateVisibility(currentCell, visibilityRange);
     CanMove = true;
 }
Ejemplo n.º 2
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;
    }