コード例 #1
0
ファイル: HiveWarehouse.cs プロジェクト: silverweed/colony
        // Convert XXX Pollen (should be Nectar, but unimplemented) to YYY Honey
        // and WWW Water + ZZZ Pollen to RoyalJelly
        private ResourceSet refineResources(Cell.RefinedResource what)
        {
            var res = new ResourceSet();

            // Ensure the player has all the due resources.

            bool refiningRJ    = (what & Cell.RefinedResource.RoyalJelly) != 0,
                 refiningHoney = (what & Cell.RefinedResource.Honey) != 0;

            int pollen = rm.GetResource(ResourceType.Pollen),
                water  = rm.GetResource(ResourceType.Water);

            if (refiningHoney && pollen >= PollenForHoney && water >= WaterForHoney)
            {
                rm.RemoveResource(ResourceType.Pollen, PollenForHoney);
                rm.RemoveResource(ResourceType.Water, WaterForHoney);
                res += new ResourceSet().With(ResourceType.Honey, RefinedHoneyYield);
            }

            if (refiningRJ && pollen >= PollenForRoyalJelly && water >= WaterForRoyalJelly)
            {
                rm.RemoveResource(ResourceType.Pollen, PollenForRoyalJelly);
                rm.RemoveResource(ResourceType.Water, WaterForRoyalJelly);
                res += new ResourceSet().With(ResourceType.RoyalJelly, RefinedRoyalJellyYield);
            }

            return(res);
        }
コード例 #2
0
 private void refine(RefinedResource what)
 {
     foreach (Cell cell in MouseActions.Instance.GetSelected<Cell>()) {
     switch (cell.CellState) {
     case Cell.State.CreateEgg:
         TextController.Instance.Add("Cannot use cell for refining while larva is in!");
         break;
     default:
         cell.Refine(what);
         UIController.Instance.SetBPRefining(what);
         break;
     }
     }
 }
コード例 #3
0
ファイル: UIController.cs プロジェクト: silverweed/colony
        public void SetBPRefining(Cell.RefinedResource resource)
        {
            bool refining = resource != Cell.RefinedResource.None;
            var  what     = refining ? BPType.Hive | BPType.Text : BPType.Hive;

            if (refining)
            {
                // /!\ Horrible workaround follows
                if ((int)resource > 1 << Enum.GetNames(typeof(Cell.RefinedResource)).Length)
                {
                    SetBPText("Refining both");
                }
                else
                {
                    SetBPText("Refining " + resource);
                }
            }
            SetBottomPanel(what);
            refineButtons.SetActive(!refining);
            stopRefineButtons.SetActive(refining);
        }
コード例 #4
0
ファイル: RefineMission.cs プロジェクト: silverweed/colony
 public RefineMission(string title, string description, Cell.RefinedResource refined) : base(title, description)
 {
     this.refined = refined;
 }
コード例 #5
0
ファイル: RefineMission.cs プロジェクト: silverweed/colony
 public RefineMission(string title, string description, Cell.RefinedResource refined)
     : base(title, description)
 {
     this.refined = refined;
 }