void Retrace() { if (unitStates == _states.ship) { pathfind.FindPath(transform.position, ship.transform.position); path = grid.path; unitStates = _states.ship; transform.position = gridgen.ClosestTile(this); waypointCount = 0; return; } if (unitStates == _states.star) { pathfind.FindPath(transform.position, star.transform.position); path = grid.path; unitStates = _states.star; transform.position = gridgen.ClosestTile(this); waypointCount = 0; return; } if (unitStates == _states.tradingpost) { pathfind.FindPath(transform.position, tradingpost.transform.position); path = grid.path; unitStates = _states.tradingpost; transform.position = gridgen.ClosestTile(this); waypointCount = 0; return; } }
private void OnMouseUp() { if (blocked != true) { currentPos = grid.ClosestTile(this); transform.position = currentPos; } else { transform.position = currentPos; } }