public void MoveToTile(SelectableTile tile, bool spendEnergy, bool teleport) { float arrowsDelay = teleport ? 0.0f : 1.5f; if (!spendEnergy) { if (teleport) { transform.position = tile.transform.position; } else { mover.MoveToPoint(tile.transform.position); } CurrentTile = tile; return; } origin = CurrentTile; // currently only happens on non-free movement if (teleport) { transform.position = tile.transform.position; } else { mover.MoveToPoint(tile.transform.position); } CurrentTile = tile; }
public void MoveToTile(SelectableTile tile, bool spendEnergy, bool teleport) { float arrowsDelay = teleport ? 0.0f : 1.5f; if (!spendEnergy) { if (teleport) { mover.Stop(); transform.position = tile.transform.position; } else { mover.MoveToPoint(tile.transform.position); } CurrentTile = tile; HideArrows(); Invoke("ShowArrows", arrowsDelay); return; } if (player.Energy >= EnergyPerDistance * 1) { player.Energy -= EnergyPerDistance * 1; origin = CurrentTile; // currently only happens on non-free movement if (teleport) { transform.position = tile.transform.position; } else { mover.MoveToPoint(tile.transform.position); } CurrentTile = tile; HideArrows(); Invoke("ShowArrows", arrowsDelay); } else { UIOverlay.Instance.OpenEnergyPopup(); } }