Beispiel #1
0
        void OnGenerateUnit(PerformerTask task)
        {
            Unit       unit       = ((GenerateUnit)task).GeneratedUnit;
            StaticUnit staticUnit = unit as StaticUnit;

            staticUnit.Position = Position;
            if (Selected)
            {
                SelectionManager.Select(staticUnit.UnitClickable);
            }
            DestroyThis();
        }
Beispiel #2
0
 // 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> ();
 }
Beispiel #3
0
        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);
            }
        }