Exemplo n.º 1
0
    void Update()
    {
        timer += Time.deltaTime;
        if (timer > patrol.Length * stepDuration)
        {
            timer -= patrol.Length * stepDuration;
        }

        // Set our position on the grid. This does not change our "real" aka "screen" position.
        dweller.MoveToCell(patrol[Mathf.FloorToInt(timer / stepDuration)]);
        // Set our real position to mimic our grid position.
        dweller.SyncRealPositionToCellPosition();
    }
Exemplo n.º 2
0
 private void SetPosition(Vector3 newPos)
 {
     transform.position = newPos;
     dweller.SyncCellPositionToRealPosition();
     dweller.SyncRealPositionToCellPosition();
 }