コード例 #1
0
ファイル: RecruitingCenter.cs プロジェクト: Hengle/VoxelGame
 public bool StartHiring()
 {
     if (finding)
     {
         return(true);
     }
     else
     {
         if (Crew.crewsList.Count < GetCrewsSlotsCount())
         {
             if (colony.energyCrystalsCount >= hireCost)
             {
                 colony.GetEnergyCrystals(hireCost);
                 finding = true;
                 return(true);
             }
             else
             {
                 GameLogUI.NotEnoughMoneyAnnounce();
                 return(false);
             }
         }
         else
         {
             GameLogUI.MakeImportantAnnounce(Localization.GetRefusalReason(RefusalReason.NotEnoughSlots));
             if (GameMaster.soundEnabled)
             {
                 GameMaster.audiomaster.Notify(NotificationSound.NotEnoughSlots);
             }
             return(false);
         }
     }
 }
コード例 #2
0
 public void ReplenishButton()
 {
     if (showingCrew == null)
     {
         replenishButton.SetActive(false);
     }
     else
     {
         if (showingCrew.membersCount == Crew.MAX_MEMBER_COUNT)
         {
             replenishButton.SetActive(false);
         }
         else
         {
             var   colony   = GameMaster.realMaster.colonyController;
             float hireCost = RecruitingCenter.REPLENISH_COST;
             if (colony.energyCrystalsCount >= hireCost)
             {
                 colony.GetEnergyCrystals(hireCost);
                 showingCrew.AddMember();
                 PrepareButtons();
             }
             else
             {
                 GameLogUI.NotEnoughMoneyAnnounce();
             }
         }
     }
 }
コード例 #3
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();
        }
    }