public void CreateSlots() { Slots.ForEach(x => x.DestroyTile()); Slots.Clear(); for (int i = 0; i < _gameDatabaseData.Height; i++) { for (int j = 0; j < _gameDatabaseData.Width; j++) { var position = new Vector3(j * (.75f + tileSpace.x), i * (1.0f + tileSpace.y)); position += j % 2 == 1 ? new Vector3(0f, -.5f) : Vector3.zero; var slot = new Slot(position); Slots.Add(slot); } } }
private void UpdateEquipCore() { Slots?.ForEach(x => x.Item?.SetNotOnShip()); int asw = rawdata.api_taisen[0]; int los = rawdata.api_sakuteki[0]; var slots = new List <Slot>(4); for (int i = 0; i < SlotNum; i++) { var slot = new Slot(); if (rawdata.api_slot[i] != -1 && (slot.Item = Staff.Current.Homeport.Equipments[rawdata.api_slot[i]]) != null) { slot.Item.OnShip = this; asw -= slot.Item.EquipInfo.ASW; los -= slot.Item.EquipInfo.LoS; } slots.Add(slot); } ASW = new LimitedValue(asw, rawdata.api_taisen[1]); LoS = new LimitedValue(los, rawdata.api_sakuteki[1]); for (int i = 0; i < slots.Count; i++) { slots[i].AirCraft = new LimitedValue(rawdata.api_onslot[i], ShipInfo.AirCraft[i]); } Slots = slots; SlotEx?.Item?.SetNotOnShip(); SlotEx = new Slot(); if (rawdata.api_slot_ex == 0) { SlotEx.IsLocked = true; } else if (rawdata.api_slot_ex != -1) { SlotEx.Item = Staff.Current.Homeport.Equipments[rawdata.api_slot_ex]; SlotEx.Item.OnShip = this; } }
private void Start() { //listen slots to know if grid is full Slots.ForEach(s => s.Symbol.Subscribe(_ => CheckIsFull())); }
/// <summary> /// Removes cars attached to the locomotive and adds them to the line /// </summary> /// <param name="line">The line that cars will be unloaded into</param> public void UnloadAllCarsIntoLine(IIncrementableLine line) { Slots.ForEach(car => line.AddCar(car)); Slots.Clear(); }