public UpgradeRoomPlan(PlayerManager player, Vector2Int pos) { this.Player = player; this.PlanType = PlanTypes.CreateUnit; this.TargetRoom = player.Nester.Rooms[pos]; this.Delay = 2; }
public void SetUpgradeRoom(AbNestRoomData room, bool value) { if (room.CanUpgrade && value) { room.IsUpgrading = true; OnNestRebuilt?.Invoke(); } else if (!value) { room.IsUpgrading = false; OnNestRebuilt?.Invoke(); } }
public void OnRoomClick(AbNestRoomData roomData) { switch (roomData.Type) { case RoomTypes.Entrance: break; case RoomTypes.BuildingSpot: var actionPanel = WindowManagerUT.Instance.OpenNewPanel <BuildingPanel>(WindowCloseModes.CloseNothing); actionPanel.OnBuild = (type => { var plan = new BuildRoomPlan(GameplayManager.Instance.Player, type, roomData.Position); GameplayManager.Instance.Player.Planer.TryToAddPlan(plan); }); break; case RoomTypes.Construction: var planToRemove = GameplayManager.Instance.Player.Planer.Plans.Find(x => (x is BuildRoomPlan) && (x as BuildRoomPlan).TargetPosition == roomData.Position); planToRemove?.Cancel(); break; case RoomTypes.Warehause: return; var warehouseUpgradePlan = new UpgradeRoomPlan(GameplayManager.Instance.Player, roomData.Position); GameplayManager.Instance.Player.Planer.TryToAddPlan(warehouseUpgradePlan); break; case RoomTypes.Nursery: return; var nurseryUpgradePlan = new UpgradeRoomPlan(GameplayManager.Instance.Player, roomData.Position); GameplayManager.Instance.Player.Planer.TryToAddPlan(nurseryUpgradePlan); break; case RoomTypes.Armory: break; default: break; } }
public static bool CheckExecutable(PlayerManager player, AbNestRoomData room) { return(player.Resourcer.IsEnough(ResourceTypes.Meat, 10) && room.CanUpgrade); }