示例#1
0
 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 bool ConsumeAndFinish()
    {
        if (completed)
        {
            return(true);
        }
        CheckQuestConditions();
        bool x = true;

        foreach (var s in stepsFinished)
        {
            if (!s)
            {
                x = false;
            }
        }
        if (!x)
        {
            return(false);
        }
        else
        {
            foreach (var sc in conditions)
            {
                switch (sc.type)
                {
                //no gears
                //no crews
                // no shuttles
                case ConditionType.ResourceCountCheck:
                {
                    colony.storage.GetResources(sc.index, sc.value);
                    break;
                }

                case ConditionType.MoneyCheck:
                {
                    colony.GetEnergyCrystals(sc.value);
                    break;
                }

                case ConditionType.FreeWorkersCheck:
                {
                    colony.ConsumeWorkers(sc.index);
                    break;
                }

                case ConditionType.StoredEnergyCondition:
                {
                    colony.TryGetEnergy(sc.value);
                    break;
                }
                }
            }
            MakeQuestCompleted();
            StopQuest(true);
            return(true);
        }
    }
示例#3
0
    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));
        }
    }
示例#4
0
    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();
        }
    }
示例#5
0
 private void BuyResource(ResourceType rt, float volume)
 {
     volume = colony.GetEnergyCrystals(volume * ResourceType.prices[rt.ID]) / ResourceType.prices[rt.ID];
     colony.storage.AddResource(rt, volume);
 }
示例#6
0
 public void LaunchButton()
 {
     if (showingExpedition == null)
     {
         if (selectedCrew != null && selectedCrew.atHome)
         {
             var storage = colony.storage;
             var res     = storage.standartResources;
             if (suppliesSlider.value <= res[ResourceType.SUPPLIES_ID] &&
                 crystalsSlider.value <= colony.energyCrystalsCount &&
                 res[ResourceType.FUEL_ID] >= FUEL_BASE_COST)
             {
                 int shID = Hangar.GetFreeShuttleID();
                 if (shID != Hangar.NO_SHUTTLE_VALUE)
                 {
                     var t = QuantumTransmitter.GetFreeTransmitter();
                     if (t != null)
                     {
                         if (storage.TryGetResources(ResourceType.Fuel, FUEL_BASE_COST))
                         {
                             var e = new Expedition(selectedDestination, selectedCrew, shID, t, storage.GetResources(ResourceType.Supplies, suppliesSlider.value), colony.GetEnergyCrystals(crystalsSlider.value));
                             if (workOnMainCanvas)
                             {
                                 showingExpedition = e;
                             }
                             else
                             {
                                 showingExpedition = null;
                                 selectedCrew      = null;
                                 GameMaster.realMaster.globalMap.observer.GetComponent <GlobalMapUI>().PreparePointDescription();
                                 gameObject.SetActive(false);
                             }
                         }
                         else
                         {
                             GameLogUI.MakeAnnouncement(Localization.GetExpeditionErrorText(ExpeditionComposingErrors.NotEnoughFuel));
                         }
                         RedrawWindow();
                     }
                 }
             }
         }
     }
     else
     {
         showingExpedition.EndMission();
     }
 }
示例#7
0
 public void LaunchButton()
 {
     if (observingExpedition == null)
     {
         if (selectedCrew != null && selectedCrew.atHome)
         {
             var  storage  = colony.storage;
             bool TESTMODE = GameMaster.realMaster.weNeedNoResources;
             if (TESTMODE || suppliesSlider.value <= storage.GetResourceCount(ResourceType.Supplies) &&
                 crystalsSlider.value <= colony.energyCrystalsCount &&
                 storage.GetResourceCount(ResourceType.Fuel) >= FUEL_BASE_COST
                 )
             {
                 int shID = Hangar.GetFreeShuttleID();
                 if (shID != Hangar.NO_SHUTTLE_VALUE)
                 {
                     var t = QuantumTransmitter.GetFreeTransmitter();
                     if (t != null)
                     {
                         if (storage.TryGetResources(ResourceType.Fuel, FUEL_BASE_COST))
                         {
                             var e  = new Expedition(selectedDestination, selectedCrew, shID, t, storage.GetResources(ResourceType.Supplies, suppliesSlider.value), colony.GetEnergyCrystals(crystalsSlider.value));
                             var mc = mycanvas.uicontroller;
                             if (mc.currentMode == UIMode.Standart)
                             {
                                 observingExpedition = e;
                             }
                             else
                             {
                                 observingExpedition = e;
                                 RedrawWindow();
                                 mc.ShowExpedition(e);
                             }
                         }
                         else
                         {
                             AnnouncementCanvasController.MakeAnnouncement(Localization.GetExpeditionErrorText(ExpeditionComposingErrors.NotEnoughFuel));
                         }
                         RedrawWindow();
                     }
                 }
             }
         }
     }
     else
     {
         observingExpedition.EndMission();
     }
 }