public static Material ghostFloorMaterial(PlacementReport placementReport) { Color color = ghostColor(placementReport); Material ghost; if (_ghostFloors.TryGetValue(color, out ghost)) { return(ghost); } ghost = new Material(_mouseOverBracketMaterial); ghost.color = color; _ghostFloors.Add(color, ghost); return(ghost); }
public static Color ghostColor(PlacementReport placementReport) { switch (placementReport) { case PlacementReport.CanNotPlace: return(ghostRed); case PlacementReport.CanPlace: return(ghostBlue); case PlacementReport.Alreadyplaced: return(ghostGrey); default: return(Color.white); } }
// note that even though we're designating a blueprint, as far as the game is concerned we're only designating the _origin_ cell public override void DesignateSingleCell(IntVec3 origin) { bool somethingSucceeded = false; bool planningMode = Event.current.shift; // looping through cells, place where needed. foreach (var item in Blueprint.AvailableContents) { PlacementReport placementReport = item.CanPlace(origin); if (planningMode && placementReport != PlacementReport.Alreadyplaced) { item.Plan(origin); somethingSucceeded = true; } if (!planningMode && placementReport == PlacementReport.CanPlace) { item.Designate(origin); somethingSucceeded = true; } } // TODO: Add succeed/failure sounds, failure reasons Finalize(somethingSucceeded); }