public override void SetBasement(SurfaceBlock b, PixelPosByte pos) { if (b == null) { return; } PrepareHouse(b, pos); if (level > 3) { if (rooftop == null) { rooftop = Instantiate(Resources.Load <GameObject>("Structures/HQ_rooftop")); rooftop.transform.parent = transform.GetChild(0); rooftop.transform.localPosition = Vector3.up * (level - 3) * Block.QUAD_SIZE; } if (level > 4) { int i = 5; while (i <= level) { b.myChunk.BlockByStructure(b.pos.x, (byte)(b.pos.y + i - 4), b.pos.z, this); GameObject addon = Instantiate(Resources.Load <GameObject>("Structures/HQ_Addon")); addon.transform.parent = transform.GetChild(0); addon.transform.localPosition = Vector3.zero + (i - 3.5f) * Vector3.up * Block.QUAD_SIZE; addon.transform.localRotation = transform.GetChild(0).localRotation; i++; } BoxCollider bc = transform.GetChild(0).GetComponent <BoxCollider>(); bc.center = Vector3.up * (level - 3) * Block.QUAD_SIZE / 2f; bc.size = new Vector3(Block.QUAD_SIZE, (level - 3) * Block.QUAD_SIZE, Block.QUAD_SIZE); } } colony = GameMaster.colonyController; colony.SetHQ(this); }
override public void SetBasement(Plane b, PixelPosByte pos) { if (b == null) { return; } SetBuildingData(b, pos); var master = GameMaster.realMaster; if (!subscribedToUpdate) { master.everydayUpdate += EverydayUpdate; subscribedToUpdate = true; } if (hotels == null) { hotels = new List <Hotel>(); hotels.Add(this); } else { if (!hotels.Contains(this)) { hotels.Add(this); } } colony = master.colonyController; if (!GameMaster.loading) { IPlanableSupportClass.AddBlockRepresentation(this, basement, ref myBlock, true); } }
private void Awake() { colony = GameMaster.realMaster.colonyController; suppliesSlider.minValue = Expedition.MIN_SUPPLIES_COUNT; suppliesSlider.maxValue = Expedition.MAX_SUPPLIES_COUNT; crystalsSlider.maxValue = Expedition.MAX_START_CRYSTALS; }
override public void SetBasement(SurfaceBlock b, PixelPosByte pos) { if (hireCost == -1) { ResetToDefaults_Static_RecruitingCenter(); } bool movement = false; if (basement != null) { movement = true; } if (b == null) { return; } SetBuildingData(b, pos); if (!subscribedToUpdate) { GameMaster.realMaster.labourUpdateEvent += LabourUpdate; subscribedToUpdate = true; } colonyController = GameMaster.colonyController; if (!movement) // здание не создавалось, а было перенесено { Crew.AddCrewSlots(CREW_SLOTS_FOR_BUILDING); progress = 0; } }
public override void SetBasement(Plane b, PixelPosByte pos) { if (b == null) { return; } colony = GameMaster.realMaster.colonyController; if (colony == null) { colony = GameMaster.realMaster.gameObject.AddComponent <ColonyController>(); colony.Prepare(); } colony.SetHQ(this); SetBuildingData(b, pos); maxHp = 1000 * level; hp = maxHp; if (level > 3) { if (!GameMaster.loading) { SetBlockers(); } else { if (!subscribedToRestoreBlockersEvent) { GameMaster.realMaster.blockersRestoreEvent += RestoreBlockers; subscribedToRestoreBlockersEvent = true; } } } }
public ConditionScenarioQuest(Scenario i_scn, SimpleCondition[] i_conditions, ColonyController i_colony) : base(i_scn) { colony = i_colony; needToCheckConditions = true; byte count = (byte)i_conditions.Length; INLINE_PrepareSteps(count); SimpleCondition sc; for (var i = 0; i < count; i++) { sc = conditions[i]; switch (sc.type) { case ConditionType.ResourceCountCheck: steps[i] = Localization.GetResourceName(sc.index); break; case ConditionType.MoneyCheck: steps[i] = Localization.GetPhrase(LocalizedPhrase.CrystalsCollected); break; case ConditionType.GearsCheck: steps[i] = Localization.GetWord(LocalizedWord.GearsLevel); break; case ConditionType.FreeWorkersCheck: steps[i] = Localization.GetWord(LocalizedWord.FreeWorkers); break; case ConditionType.StoredEnergyCondition: steps[i] = Localization.GetPhrase(LocalizedPhrase.EnergyStored); break; case ConditionType.CrewsCondition: steps[i] = Localization.ComposeCrewLevel((byte)sc.value) + ':'; break; case ConditionType.ShuttlesCount: steps[i] = Localization.GetWord(LocalizedWord.Shuttles) + ':'; break; } } }
void LabourUpdate() { if (GameMaster.realMaster.gameMode == GameMode.Editor) { return; } ColonyController colony = GameMaster.realMaster.colonyController; if (colony == null) { return; } int docksCount = colony.docks.Count; if (shipsClearTimer > 0) { shipsClearTimer -= Time.deltaTime * GameMaster.gameSpeed; if (shipsClearTimer <= 0) { if (inactiveShips.Count > SHIPS_BUFFER_SIZE) { Destroy(inactiveShips[0].gameObject); inactiveShips.RemoveAt(0); } shipsClearTimer = clearTime; } } }
public BuildFarmSCN() : base() { step = TutorialStep.BuildFarm; colony = GameMaster.realMaster.colonyController; useSpecialQuestFilling = true; useSpecialWindowFilling = true; }
public FoundationRouteScenario() : base(FOUNDATION_ROUTE_ID) { localizer = new Localizer(); colony = GameMaster.realMaster.colonyController; questUI = UIController.GetCurrent().GetMainCanvasController().questUI; Knowledge.GetCurrent()?.SetExecutingScenarioIndex((int)Knowledge.ResearchRoute.Foundation); }
public void StartConstructing() { if (observingHangar.constructing) { observingHangar.StopConstruction(); PrepareHangarWindow(); } else { if (GameMaster.colonyController.energyCrystalsCount >= Shuttle.STANDART_COST) { ColonyController colony = GameMaster.colonyController; colony.GetEnergyCrystals(Shuttle.STANDART_COST); if (colony.storage.CheckBuildPossibilityAndCollectIfPossible(ResourcesCost.GetCost(ResourcesCost.SHUTTLE_BUILD_COST_ID))) { observingHangar.StartConstruction(); PrepareHangarWindow(); } else { UIController.current.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.NotEnoughResources)); } } else { UIController.current.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.NotEnoughEnergyCrystals)); constructButton.GetComponent <Image>().overrideSprite = null; } } }
public static Crew CreateNewCrew(ColonyController home, int membersCount) { if (crewsList.Count >= RecruitingCenter.GetCrewsSlotsCount()) { return(null); } if (crewsList.Count > MAX_CREWS_COUNT) { GameLogUI.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.CrewsLimitReached)); GameMaster.LoadingFail(); return(null); } Crew c = new GameObject(Localization.NameCrew()).AddComponent <Crew>(); if (crewsContainer == null) { crewsContainer = new GameObject("crewsContainer"); } c.transform.parent = crewsContainer.transform; c.ID = nextID; nextID++; c.atHome = true; //normal parameters c.membersCount = (byte)membersCount; //attributes c.SetAttributes(home); // crewsList.Add(c); listChangesMarkerValue++; return(c); }
public Worksite(Plane i_workplace) { colony = GameMaster.realMaster.colonyController; workplace = i_workplace; colony.AddWorksiteToList(this); destroyed = false; GameMaster.realMaster.labourUpdateEvent += WorkUpdate; subscribedToUpdate = true; }
public MainWindowViewModel(ColonyController colonyController) { ColonyController = colonyController; Categories = ColonyController.FindCategories(); Tick = new CommandHandler(() => { ColonyController.Tick(); UpdateView(); new Persister().Save(ColonyController.Colony); }); }
public void Prepare(HexBuilder hb) { hexBuilder = hb; colony = GameMaster.realMaster.colonyController; constructionWindow.SetActive(false); statsPanel.SetActive(false); buildingsCount = new int[(int)HexType.TotalCount]; RecalculateAvailabilityMask(); hexBuilder.scenario.LoadHexInfo(out conditionStrings, out buildingsInfo); taskIncompletedRect = UIController.GetIconUVRect(Icons.TaskFrame); taskCompletedRect = UIController.GetIconUVRect(Icons.TaskCompleted); }
public ConditionQuest(SimpleCondition i_condition, ColonyController i_colony, bool i_completeQuestWhenPossible, QuestIcon cqi) : base(QuestType.Condition, (byte)cqi) { colony = i_colony; needToCheckConditions = true; completeQuestWhenPossible = i_completeQuestWhenPossible; iconType = cqi; INLINE_PrepareSteps(1); conditions = new SimpleCondition[1] { i_condition }; INLINE_DefineStep(ref i_condition, 0); CheckQuestConditions(); }
public ConditionQuest(SimpleCondition[] i_conditions, ColonyController i_colony, bool i_completeQuestWhenPossible, QuestIcon cqi) : base(QuestType.Condition, (byte)cqi) { colony = i_colony; needToCheckConditions = true; completeQuestWhenPossible = i_completeQuestWhenPossible; byte count = (byte)i_conditions.Length; INLINE_PrepareSteps(count); conditions = i_conditions; for (var i = 0; i < count; i++) { INLINE_DefineStep(ref conditions[i], i); } iconType = cqi; CheckQuestConditions(); }
public void Charge() { ColonyController colony = GameMaster.colonyController; if (colony.energyCrystalsCount >= 1) { if (colony.energyStored != colony.totalEnergyCapacity) { colony.GetEnergyCrystals(1); colony.AddEnergy(GameMaster.ENERGY_IN_CRYSTAL); } } else { UIController.current.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.NotEnoughEnergyCrystals)); } }
public static float DefineAscension(ColonyController c) { if (c == null) { return(0f); } float maxVal = GameConstants.ASCENSION_VERYLOW; var lvl = c.hq?.level ?? 0; if (lvl > 1) { switch (lvl) { case 2: case 3: maxVal = GameConstants.ASCENSION_LOW; break; case 4: maxVal = GameConstants.ASCENSION_MEDIUM; break; case 5: case 6: maxVal = GameConstants.ASCENSION_HIGH; break; } } if (c.HaveBuilding(Structure.MONUMENT_ID)) { maxVal += 10f; } if (c.HaveBuilding(Structure.QUANTUM_ENERGY_TRANSMITTER_5_ID)) { maxVal += 10f; } //if (HaveBuilding(Structure.ASCENSION_ENGINE)) maxVal += 10f; var a = Knowledge.GetCurrent()?.GetCompleteness() ?? 0f; if (a > maxVal) { a = maxVal; } return(a); }
public static float GetMaxGearsCf(ColonyController c) { byte lvl = c.hq?.level ?? 0; if (lvl == 0) { return(GEARS_LOWER_LIMIT); } else { if (lvl < 6) { return(lvl); } else { return(5); } } }
public void SetObservingSurface(Plane sb) { if (sb == null || sb.destroyed) { SelfShutOff(); return; } else { colony = GameMaster.realMaster.colonyController; hq = colony.hq; observingSurface = sb; isObserving = true; ChangeMode(SurfacePanelMode.SelectAction); if (constructionPlane.activeSelf) { PrepareConstructionPlane(); } } }
public void Charge() { ColonyController colony = GameMaster.realMaster.colonyController; if (colony.energyCrystalsCount >= 1) { if (colony.energyStored != colony.totalEnergyCapacity) { colony.GetEnergyCrystals(1); colony.AddEnergy(GameConstants.ENERGY_IN_CRYSTAL); if (GameMaster.soundEnabled) { GameMaster.audiomaster.Notify(NotificationSound.BatteryCharged); } } } else { GameLogUI.NotEnoughMoneyAnnounce(); } }
override public void SetBasement(Plane b, PixelPosByte pos) { if (b == null) { return; } SetStructureData(b, pos); if (!subscribedToUpdate) { GameMaster.realMaster.labourUpdateEvent += LabourUpdate; subscribedToUpdate = true; } if (current != null) { current.Annihilate(true, true, false); } current = this; colony = GameMaster.realMaster.colonyController; connectedToPowerGrid = true; isEnergySupplied = true; SetActivationStatus(false, true); }
public void StartConstructing() { if (observingHangar.status == Hangar.HangarStatus.ConstructingShuttle) { observingHangar.StopConstruction(); PrepareHangarWindow(); } else { ColonyController colony = GameMaster.realMaster.colonyController; if (colony.storage.CheckBuildPossibilityAndCollectIfPossible(ResourcesCost.GetCost(ResourcesCost.SHUTTLE_BUILD_COST_ID))) { observingHangar.StartConstruction(); PrepareHangarWindow(); } else { AnnouncementCanvasController.NotEnoughResourcesAnnounce(); } } }
private void pictureBox_MouseClick(object sender, MouseEventArgs e) { // CHECK PICTUREBOX IS NOT EMPTY if (pictureBox.Image != null) { if (e.Button == MouseButtons.Left) { if (!currentResult.Berekend) { if (OptionSelect == 0) { mainController.colonyController.SetColorRange(pictureBox, e, true, AchtergrondPanelKleur); lblSelect.Text = "Selecteer een kolonie."; OptionSelect = 1; btnReset.Enabled = true; } else { mainController.colonyController.SetColorRange(pictureBox, e, false, KoloniePanelKleur); OptionSelect = 2; lblSelect.Visible = false; btnReset.Enabled = true; } } else { ColonyController.AddColony(e.X, e.Y, pictureBox, currentResult); } } if (e.Button == MouseButtons.Right) { ColonyController.RemoveKolonie(e.X, e.Y, pictureBox, currentResult); } DrawCircles(); pictureBox.Invalidate(); } RefreshTxt(); }
public void ColonyButton() { showColonyInfo = !showColonyInfo; if (showColonyInfo) { if (showStorageInfo) { StorageButton(); } else { if (showLayerCut) { LayerCutButton(); } } colonyPanel.SetActive(true); colonyToggleButton.overrideSprite = PoolMaster.gui_overridingSprite; ColonyController colony = GameMaster.colonyController; if (colony == null) { return; } showingGearsCf = colony.gears_coefficient; showingHappinessCf = colony.happiness_coefficient; showingBirthrate = colony.realBirthrate; showingHospitalCf = colony.hospitals_coefficient; showingHealthCf = colony.health_coefficient; gearsText.text = string.Format("{0:0.###}", showingGearsCf); happinessText.text = string.Format("{0:0.##}", showingHappinessCf * 100) + '%'; birthrateText.text = showingBirthrate > 0 ? '+' + string.Format("{0:0.#####}", showingBirthrate) : string.Format("{0:0.#####}", showingBirthrate); hospitalText.text = string.Format("{0:0.##}", showingHospitalCf * 100) + '%'; healthText.text = string.Format("{0:0.##}", showingHealthCf * 100) + '%'; } else { colonyPanel.SetActive(false); colonyToggleButton.overrideSprite = null; } }
/// <summary> /// Adds a colony on left mouse click. /// Removes a colony on right mouse click. /// Selects a color on left mouse click when there is no color selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pictureBox_MouseClick(object sender, MouseEventArgs e) { if (pictureBox.Image != null && editable == true) { try { //lblColor.Text = "Kleur: " + mainController.inleesViewController.countModel.GetSelectedColor(pictureBox, e); } catch (ArgumentOutOfRangeException ex) { Console.WriteLine(ex); } if (e.Button == MouseButtons.Left) { if (!ResultModel.Berekend) { mainController.colonyController.SetColorRange(pictureBox, e, true); mainController.colonyController.SetColorRange(pictureBox, e, false); OptionSelect = 1; labelKleur.Visible = false; } else { ColonyController.AddColony(e.X, e.Y, pictureBox, ResultModel); ResultModel.Kolonies = ResultModel.ColonyList.Count; DrawCircles(); } } if (e.Button == MouseButtons.Right) { ColonyController.RemoveKolonie(e.X, e.Y, pictureBox, ResultModel); ResultModel.Kolonies = ResultModel.ColonyList.Count; DrawCircles(); } } pictureBox.Invalidate(); SetTextBox(); }
override public void SetBasement(SurfaceBlock b, PixelPosByte pos) { if (b == null) { return; } SetStructureData(b, pos); if (!subscribedToUpdate) { GameMaster.realMaster.labourUpdateEvent += LabourUpdate; subscribedToUpdate = true; } isActive = true; if (current != null) { current.Annihilate(false); } current = this; colony = GameMaster.colonyController; colony.accumulateEnergy = false; connectedToPowerGrid = true; }
override public void SetBasement(SurfaceBlock b, PixelPosByte pos) { if (b == null) { return; } SetBuildingData(b, pos); basement.ReplaceMaterial(ResourceType.CONCRETE_ID); colony = GameMaster.colonyController; colony.AddDock(this); if (!subscribedToUpdate) { GameMaster.realMaster.labourUpdateEvent += LabourUpdate; subscribedToUpdate = true; } if (!subscribedToChunkUpdate) { basement.myChunk.ChunkUpdateEvent += ChunkUpdated; subscribedToChunkUpdate = true; } dependentBlocksList = new List <Block>(); // #checkPositionCorrectness switch (modelRotation) { case 0: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.z + 1, basement.pos.y - 1, false, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break; case 2: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.x + 1, basement.pos.y - 1, true, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break; case 4: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.z - 2, basement.pos.y - 1, false, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break; case 6: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.x - 2, basement.pos.y - 1, true, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break; } // end if (correctLocation) { shipArrivingTimer = SHIP_ARRIVING_TIME * GameMaster.tradeVesselsTrafficCoefficient * (1 - (colony.docksLevel * 2 / 100f)) / 2f; } }
public void SetCrew(ColonyController home, float hireCost) { level = 0; name = Localization.NameCrew(); ID = lastNumber; lastNumber++; salary = ((int)((hireCost / 12f) * 100)) / 100f; perception = 1; // сделать зависимость от исследованных технологий persistence = home.happiness_coefficient * 0.85f + 0.15f; luck = Random.value; bravery = 0.3f * Random.value + persistence * 0.3f + 0.4f * home.health_coefficient; techSkills = 0.5f * home.hq.level / 8f + 0.5f; // сделать зависимость от количества общих видов построенных зданий survivalSkills = persistence * 0.15f + luck * 0.05f + techSkills * 0.15f + bravery * 0.15f + 0.5f; // еще пара зависимостей от зданий teamWork = 0.75f * home.happiness_coefficient + 0.25f * Random.value; stamina = 0.9f + Random.value * 0.1f; count = (int)(MIN_MEMBERS_COUNT + (Random.value * 0.3f + 0.7f * (float)home.freeWorkers / (float)OPTIMAL_CANDIDATS_COUNT) * (MAX_MEMBER_COUNT - MIN_MEMBERS_COUNT)); if (count > MAX_MEMBER_COUNT) { count = MAX_MEMBER_COUNT; } crewSlots--; }
public void ChangeMode(SurfacePanelMode newMode) { switch (newMode) { case SurfacePanelMode.Build: { int i = 0; hq = GameMaster.colonyController.hq; buildingsLevelToggles[0].transform.parent.gameObject.SetActive(true); while (i < buildingsLevelToggles.Length) { if (i >= hq.level) { buildingsLevelToggles[i].gameObject.SetActive(false); } else { buildingsLevelToggles[i].gameObject.SetActive(true); if (i == constructingLevel - 1) { buildingsLevelToggles[i].isOn = true; } else { buildingsLevelToggles[i].isOn = false; } } i++; } SetActionPanelStatus(false); SetBuildPanelStatus(true); returnButton.gameObject.SetActive(true); buildingButtonsContainer.gameObject.SetActive(true); // "surfaceBuildingPanel" RewriteBuildingButtons(); mode = SurfacePanelMode.Build; break; } case SurfacePanelMode.SelectAction: if (constructionPlane.activeSelf) { SwitchConstructionPlane(false); } buildIntersectionSubmit.SetActive(false); switch (mode) { case SurfacePanelMode.Build: SetBuildPanelStatus(false); break; } SetActionPanelStatus(true); mode = SurfacePanelMode.SelectAction; CheckGatherButton(); ColonyController colony = GameMaster.colonyController; if (colony.gears_coefficient >= 2) { changeMaterialButton.gameObject.SetActive(true); } else { changeMaterialButton.gameObject.SetActive(false); } columnCreateButton.gameObject.SetActive(IsColumnAvailable() & observingSurface.pos.y < Chunk.CHUNK_SIZE - 1); blockCreateButton.gameObject.SetActive(colony.hq.level > 5); break; } }