void OnGenerateUnit(PerformerTask task) { Unit unit = ((GenerateUnit)task).GeneratedUnit; StaticUnit staticUnit = unit as StaticUnit; staticUnit.Position = Position; if (Selected) { SelectionManager.Select(staticUnit.UnitClickable); } DestroyThis(); }
// TODO: update this to work with new points // this happens e.g. when coffee runs out of resources protected void Destroy <T> (bool enablePathPoint = true) where T : StaticUnit { if (enablePathPoint) { StaticUnit plot = ObjectPool.Instantiate <Plot> () as StaticUnit; plot.Position = Position; if (Selected) { SelectionManager.Select(plot.UnitClickable); } } DestroyThis <T> (); }
public virtual void OnOverrideSelect(ISelectable overridenSelectable) { StaticUnit u = overridenSelectable as StaticUnit; if (u != null) { // Ignore points that can't be reached GridPoint gp = u.Element as GridPoint; if (gp != null && !gp.HasRoad) { return; } AssignPoint(u.Element); } }