Example #1
0
        private void UpdateShipSelectedOre(CargoHold hold)
        {
            var ore = oreGen.GetOre(hold.cargoName);

            cargoHoldText.text     = "Hold " + hold.holdId + " (" + (hold.orgProof ? "+O" : "") + (hold.radProof ? " +R" : "") + ")";
            cargoItemText.text     = ore.name;
            cargoItemImage.sprite  = ore.cargoSprite;
            cargoItemImage.color   = palette.GetColor(ore.hue, ore.colorValue);
            cargoItemTypeText.text = hold.cargoType;



            for (int i = 0; i < cargoSolTimes.Count; i++)
            {
                if (hold.solTimer == null || i >= hold.solTimer.Count)
                {
                    cargoSolTimes[i].text = "Empty";
                }
                else
                {
                    var remaining = ore.decayRate - (Game.instance.state.sol - hold.solTimer[i]);
                    cargoSolTimes[i].text = remaining <= 0 ? "Empty" : remaining + " Sol";
                }
            }
        }
Example #2
0
 private void UpdateCargoHolds()
 {
     for (int i = 0; i < cargoItems.Count; i++)
     {
         CargoHold hold = Game.instance.state.shipState.cargoHold[i];
         cargoItems[i].UpdatePanel(hold);
     }
 }
Example #3
0
        public void UpdatePanel(CargoHold hold)
        {
            cargoHold = hold;

            switch (hold.cargoType)
            {
            case "Ore":
                UpdateCargoHoldOre();
                break;

            case "":
            default:
                UpdateCargooHoldEmpty();
                break;
            }
        }
Example #4
0
        // Probably should have its own class
        public bool AddOre(string name, int count)
        {
            Logger.Log(this.name, "Add Ore", name, count.ToString());

            for (int i = 0; i < state.shipState.cargoHold.Count; i++)
            {
                if (count <= 0)
                {
                    break;
                }

                CargoHold hold = state.shipState.cargoHold.FirstOrDefault(h => h.cargoType == "Ore" && h.cargoName == name && h.count < h.maxCount);

                if (hold == null)
                {
                    Logger.Log(name, "no existing hold found");
                    hold           = state.shipState.cargoHold.FirstOrDefault(h => h.cargoType == "");
                    hold.cargoType = "Ore";
                    hold.cargoName = name;
                }

                int total = Mathf.Min(count, hold.maxCount - hold.count);
                for (int j = 0; j < count; j++)
                {
                    hold.solTimer.Add(state.sol);
                }
                hold.count += total;
                count      -= total;
            }

            if (count == 0)
            {
                return(true);
            }

            return(false);
        }