Docking System
Entities now have dedicated docking bays with their own cargo area for loading/unloading Inventory panel allows display of any ship or cargo bay at the currently docked station or within the current ship if undocked
This commit is contained in:
parent
615cc4e936
commit
2d9bec0e33
24 changed files with 553 additions and 465 deletions
|
|
@ -32,12 +32,14 @@ public class ActionGameManager : MonoBehaviour
|
|||
private float _time;
|
||||
private AetheriaInput _input;
|
||||
private int _zoomLevelIndex;
|
||||
private Ship _currentShip;
|
||||
public List<Ship> PlayerShips { get; } = new List<Ship>();
|
||||
|
||||
public DatabaseCache ItemData { get; private set; }
|
||||
public ItemManager ItemManager { get; private set; }
|
||||
public Zone Zone { get; private set; }
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
ConsoleController.MessageReceiver = this;
|
||||
|
|
@ -113,11 +115,17 @@ public class ActionGameManager : MonoBehaviour
|
|||
var stationOrbit = Zone.CreateOrbit(parentOrbit, stationPos);
|
||||
var station = new OrbitalEntity(ItemManager, Zone, stationHull, stationOrbit.ID);
|
||||
Zone.Entities.Add(station);
|
||||
var dockingBayData = ItemData.GetAll<DockingBayData>().First();
|
||||
var dockingBay = ItemManager.CreateInstance(dockingBayData, 1, 1) as EquippableItem;
|
||||
station.TryEquip(dockingBay);
|
||||
|
||||
var hullType = ItemData.GetAll<HullData>().First(x=>x.HullType==HullType.Ship);
|
||||
var shipHull = ItemManager.CreateInstance(hullType, 0, 1) as EquippableItem;
|
||||
var ship = new Ship(ItemManager, Zone, shipHull);
|
||||
|
||||
PlayerShips.Add(ship);
|
||||
_currentShip = ship;
|
||||
station.TryDock(ship);
|
||||
|
||||
// MapButton.onClick.AddListener(() =>
|
||||
// {
|
||||
// if (_currentMenuTabButton == MapPanel) return;
|
||||
|
|
@ -138,6 +146,30 @@ public class ActionGameManager : MonoBehaviour
|
|||
FollowCamera.gameObject.SetActive(!_editMode);
|
||||
TopDownCamera.gameObject.SetActive(_editMode);
|
||||
}
|
||||
|
||||
public IEnumerable<EquippedCargoBay> AvailableCargoBays()
|
||||
{
|
||||
if (_currentShip.Parent != null)
|
||||
{
|
||||
foreach (var bay in _currentShip.Parent.DockingBays)
|
||||
{
|
||||
if (PlayerShips.Contains(bay.DockedShip)) yield return bay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Ship> AvailableShips()
|
||||
{
|
||||
if (_currentShip.Parent != null)
|
||||
{
|
||||
foreach (var ship in PlayerShips)
|
||||
{
|
||||
if (_currentShip.Parent.Children.Contains(ship)) yield return ship;
|
||||
}
|
||||
}
|
||||
else
|
||||
yield return _currentShip;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -242,9 +242,16 @@ public class DatabaseListView : EditorWindow
|
|||
else if(_itemTypes[i] == typeof(CompoundCommodityData))
|
||||
itemGroups = typedItems.GroupBy(item => Enum.GetName(typeof(CompoundCommodityCategory), (item as CompoundCommodityData).Category));
|
||||
else if(_itemTypes[i] == typeof(GearData))
|
||||
itemGroups = typedItems.GroupBy(item => Enum.GetName(typeof(HardpointType), (item as GearData).Hardpoint));
|
||||
else if(_itemTypes[i] == typeof(HullData))
|
||||
itemGroups = typedItems.GroupBy(item =>
|
||||
{
|
||||
var hp = Enum.GetName(typeof(HardpointType), (item as GearData).Hardpoint);
|
||||
if (hp == null)
|
||||
hp = "Invalid Hardpoint";
|
||||
return hp;
|
||||
});
|
||||
else if (_itemTypes[i] == typeof(HullData))
|
||||
itemGroups = typedItems.GroupBy(item => Enum.GetName(typeof(HullType), (item as HullData).HullType));
|
||||
else itemGroups = typedItems.GroupBy(item => "All");
|
||||
|
||||
foreach (var itemGroup in itemGroups)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public abstract class ControllerBase<T> : IBehavior, IController<T>, IInitializa
|
|||
Entity = entity;
|
||||
_controllerData = data;
|
||||
CheckSpaceworthiness();
|
||||
entity.EquippedItems.ObserveAdd().Subscribe(added => CheckSpaceworthiness());
|
||||
entity.Equipment.ObserveAdd().Subscribe(added => CheckSpaceworthiness());
|
||||
}
|
||||
|
||||
private void CheckSpaceworthiness()
|
||||
|
|
|
|||
|
|
@ -59,14 +59,14 @@ public class StatModifier : IBehavior, IInitializableBehavior, IDisposableBehavi
|
|||
if (statField != null)
|
||||
{
|
||||
if (typeof(EquippableItemData).IsAssignableFrom(targetType))
|
||||
_stats = Entity.EquippedItems
|
||||
_stats = Entity.Equipment
|
||||
.Select(hp => hp.EquippableItem)
|
||||
.Where(gear => _data.RequireBehavior == null || Context.GetData(gear).Behaviors.Any(behavior => behavior.GetType() == _data.RequireBehavior))
|
||||
.Where(gear => Context.GetData(gear).GetType() == targetType)
|
||||
.Select(gear => statField.GetValue(Context.GetData(gear)) as PerformanceStat)
|
||||
.ToArray();
|
||||
else
|
||||
_stats = Entity.EquippedItems
|
||||
_stats = Entity.Equipment
|
||||
.Select(hp => hp.EquippableItem)
|
||||
.Where(gear => _data.RequireBehavior == null || Context.GetData(gear).Behaviors.Any(behavior => behavior.GetType() == _data.RequireBehavior))
|
||||
.SelectMany(gear => Context.GetData(gear).Behaviors)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ public abstract class Entity
|
|||
public float[,] Temperature;
|
||||
public float Energy;
|
||||
|
||||
public readonly ReactiveCollection<EquippedItem> EquippedItems = new ReactiveCollection<EquippedItem>();
|
||||
public readonly ReactiveCollection<EquippedCargoBay> EquippedCargoBays = new ReactiveCollection<EquippedCargoBay>();
|
||||
public readonly ReactiveCollection<EquippedItem> Equipment = new ReactiveCollection<EquippedItem>();
|
||||
public readonly ReactiveCollection<EquippedCargoBay> CargoBays = new ReactiveCollection<EquippedCargoBay>();
|
||||
public readonly ReactiveCollection<EquippedDockingBay> DockingBays = new ReactiveCollection<EquippedDockingBay>();
|
||||
|
||||
public Entity Parent;
|
||||
public List<Entity> Children = new List<Entity>();
|
||||
|
|
@ -60,7 +61,7 @@ public abstract class Entity
|
|||
_active = value;
|
||||
if (_active)
|
||||
{
|
||||
foreach (var hardpoint in EquippedItems)
|
||||
foreach (var hardpoint in Equipment)
|
||||
if(hardpoint.EquippableItem!=null)
|
||||
foreach (var behavior in hardpoint.Behaviors)
|
||||
{
|
||||
|
|
@ -76,6 +77,7 @@ public abstract class Entity
|
|||
ItemManager = itemManager;
|
||||
Zone = zone;
|
||||
Hull = hull;
|
||||
Name = hull.Name;
|
||||
MapShip();
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +131,7 @@ public abstract class Entity
|
|||
|
||||
public EquippedCargoBay FindItemInCargo(Guid itemDataID)
|
||||
{
|
||||
return EquippedCargoBays.FirstOrDefault(c => c.ItemsOfType.ContainsKey(itemDataID));
|
||||
return CargoBays.FirstOrDefault(c => c.ItemsOfType.ContainsKey(itemDataID));
|
||||
}
|
||||
|
||||
// Attempts to move a given number of items of the given type to the target Entity
|
||||
|
|
@ -139,7 +141,7 @@ public abstract class Entity
|
|||
int quantityTransferred = 0;
|
||||
while (quantityTransferred < quantity)
|
||||
{
|
||||
EquippedCargoBay originInventory = EquippedCargoBays.FirstOrDefault(c => c.ItemsOfType.ContainsKey(itemDataID));
|
||||
EquippedCargoBay originInventory = CargoBays.FirstOrDefault(c => c.ItemsOfType.ContainsKey(itemDataID));
|
||||
|
||||
if (originInventory == null) break;
|
||||
|
||||
|
|
@ -148,7 +150,7 @@ public abstract class Entity
|
|||
if (itemInstance is SimpleCommodity simpleCommodity)
|
||||
{
|
||||
var targetQuantity = min(simpleCommodity.Quantity, quantity - quantityTransferred);
|
||||
if (!target.EquippedCargoBays.Any(c => originInventory.TryTransferItem(c, simpleCommodity, targetQuantity)))
|
||||
if (!target.CargoBays.Any(c => originInventory.TryTransferItem(c, simpleCommodity, targetQuantity)))
|
||||
{
|
||||
quantityTransferred += targetQuantity - simpleCommodity.Quantity;
|
||||
break;
|
||||
|
|
@ -158,7 +160,7 @@ public abstract class Entity
|
|||
}
|
||||
else if (itemInstance is CraftedItemInstance craftedItemInstance)
|
||||
{
|
||||
if (!target.EquippedCargoBays.Any(c => originInventory.TryTransferItem(c, craftedItemInstance)))
|
||||
if (!target.CargoBays.Any(c => originInventory.TryTransferItem(c, craftedItemInstance)))
|
||||
break;
|
||||
|
||||
quantityTransferred++;
|
||||
|
|
@ -184,10 +186,10 @@ public abstract class Entity
|
|||
return null;
|
||||
}
|
||||
|
||||
EquippedCargoBays.Remove(cargoBay);
|
||||
CargoBays.Remove(cargoBay);
|
||||
}
|
||||
|
||||
EquippedItems.Remove(item);
|
||||
Equipment.Remove(item);
|
||||
|
||||
var itemData = ItemManager.GetData(item.EquippableItem);
|
||||
foreach (var i in itemData.Shape.Coordinates)
|
||||
|
|
@ -308,13 +310,21 @@ public abstract class Entity
|
|||
EquippedItem equippedItem;
|
||||
if(itemData is CargoBayData)
|
||||
{
|
||||
equippedItem = new EquippedCargoBay(ItemManager, item, hullCoord);
|
||||
EquippedCargoBays.Add((EquippedCargoBay) equippedItem);
|
||||
if (itemData is DockingBayData)
|
||||
{
|
||||
equippedItem = new EquippedDockingBay(ItemManager, item, hullCoord, $"{Name} Docking Bay {DockingBays.Count + 1}");
|
||||
DockingBays.Add((EquippedDockingBay) equippedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
equippedItem = new EquippedCargoBay(ItemManager, item, hullCoord, $"{Name} Cargo Bay {CargoBays.Count + 1}");
|
||||
CargoBays.Add((EquippedCargoBay) equippedItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
equippedItem = new EquippedItem(ItemManager, item, hullCoord);
|
||||
EquippedItems.Add(equippedItem);
|
||||
Equipment.Add(equippedItem);
|
||||
}
|
||||
|
||||
foreach (var i in itemData.Shape.Coordinates)
|
||||
|
|
@ -329,7 +339,7 @@ public abstract class Entity
|
|||
else
|
||||
{
|
||||
var equippedItem = new EquippedItem(ItemManager, item, hullCoord);
|
||||
EquippedItems.Add(equippedItem);
|
||||
Equipment.Add(equippedItem);
|
||||
|
||||
foreach (var i in itemData.Shape.Coordinates)
|
||||
{
|
||||
|
|
@ -340,7 +350,38 @@ public abstract class Entity
|
|||
Hydrate(equippedItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public EquippedDockingBay TryDock(Ship ship)
|
||||
{
|
||||
var bay = DockingBays.FirstOrDefault(x => x.DockedShip == null);
|
||||
if (bay != null)
|
||||
{
|
||||
bay.DockedShip = ship;
|
||||
ship.SetParent(this);
|
||||
Zone.Entities.Remove(ship);
|
||||
}
|
||||
|
||||
return bay;
|
||||
}
|
||||
|
||||
public bool TryUndock(Ship ship)
|
||||
{
|
||||
var bay = DockingBays.FirstOrDefault(x => x.DockedShip == ship);
|
||||
if (bay == null)
|
||||
{
|
||||
ItemManager.Log($"Ship {ship.Name} attempted to undock from {Name}, but it was not docked!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bay.Cargo.Any())
|
||||
return false;
|
||||
|
||||
bay.DockedShip = null;
|
||||
ship.RemoveParent();
|
||||
Zone.Entities.Add(ship);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AddChild(Entity entity)
|
||||
|
|
@ -372,7 +413,7 @@ public abstract class Entity
|
|||
|
||||
public T GetBehavior<T>() where T : class, IBehavior
|
||||
{
|
||||
foreach (var equippedItem in EquippedItems)
|
||||
foreach (var equippedItem in Equipment)
|
||||
foreach (var behavior in equippedItem.Behaviors)
|
||||
if (behavior is T b)
|
||||
return b;
|
||||
|
|
@ -381,7 +422,7 @@ public abstract class Entity
|
|||
|
||||
public IEnumerable<T> GetBehaviors<T>() where T : class, IBehavior
|
||||
{
|
||||
foreach (var equippedItem in EquippedItems)
|
||||
foreach (var equippedItem in Equipment)
|
||||
foreach (var behavior in equippedItem.Behaviors)
|
||||
if (behavior is T b)
|
||||
yield return b;
|
||||
|
|
@ -389,7 +430,7 @@ public abstract class Entity
|
|||
|
||||
public IEnumerable<T> GetBehaviorData<T>() where T : BehaviorData
|
||||
{
|
||||
foreach (var equippedItem in EquippedItems)
|
||||
foreach (var equippedItem in Equipment)
|
||||
foreach (var behavior in equippedItem.Behaviors)
|
||||
if (behavior.Data is T b)
|
||||
yield return b;
|
||||
|
|
@ -397,7 +438,7 @@ public abstract class Entity
|
|||
|
||||
public Switch GetSwitch<T>() where T : class, IBehavior
|
||||
{
|
||||
foreach (var equippedItem in EquippedItems)
|
||||
foreach (var equippedItem in Equipment)
|
||||
foreach (var group in equippedItem.BehaviorGroups)
|
||||
foreach(var behavior in group.Behaviors)
|
||||
if (behavior is T)
|
||||
|
|
@ -407,7 +448,7 @@ public abstract class Entity
|
|||
|
||||
public Trigger GetTrigger<T>() where T : class, IBehavior
|
||||
{
|
||||
foreach (var equippedItem in EquippedItems)
|
||||
foreach (var equippedItem in Equipment)
|
||||
foreach (var group in equippedItem.BehaviorGroups)
|
||||
foreach(var behavior in group.Behaviors)
|
||||
if (behavior is T)
|
||||
|
|
@ -419,7 +460,7 @@ public abstract class Entity
|
|||
{
|
||||
if (Active)
|
||||
{
|
||||
foreach (var equippedItem in EquippedItems)
|
||||
foreach (var equippedItem in Equipment)
|
||||
{
|
||||
equippedItem.Update(delta);
|
||||
}
|
||||
|
|
@ -534,10 +575,12 @@ public class EquippedCargoBay : EquippedItem
|
|||
|
||||
public float Mass { get; private set; }
|
||||
public float ThermalMass { get; private set; }
|
||||
public string Name { get; }
|
||||
|
||||
public EquippedCargoBay(ItemManager itemManager, EquippableItem item, int2 position) : base(itemManager, item, position)
|
||||
public EquippedCargoBay(ItemManager itemManager, EquippableItem item, int2 position, string name) : base(itemManager, item, position)
|
||||
{
|
||||
Data = _itemManager.GetData(EquippableItem) as CargoBayData;
|
||||
Name = name;
|
||||
|
||||
Mass = Data.Mass;
|
||||
ThermalMass = Data.Mass * Data.SpecificHeat;
|
||||
|
|
@ -780,6 +823,17 @@ public class EquippedCargoBay : EquippedItem
|
|||
}
|
||||
}
|
||||
|
||||
public class EquippedDockingBay : EquippedCargoBay
|
||||
{
|
||||
public Ship DockedShip;
|
||||
public int2 MaxSize => _data.MaxSize;
|
||||
private DockingBayData _data;
|
||||
public EquippedDockingBay(ItemManager itemManager, EquippableItem item, int2 position, string name) : base(itemManager, item, position, name)
|
||||
{
|
||||
_data = _itemManager.GetData(EquippableItem) as DockingBayData;
|
||||
}
|
||||
}
|
||||
|
||||
public class BehaviorGroup
|
||||
{
|
||||
public IBehavior[] Behaviors;
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ public class CargoBayData : EquippableItemData
|
|||
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class DockingBayData : CargoBayData
|
||||
{
|
||||
[InspectableField, JsonProperty("maxSize"), Key(13)]
|
||||
[InspectableField, JsonProperty("maxSize"), Key(14)]
|
||||
public int2 MaxSize;
|
||||
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Tool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ContextMenu : MonoBehaviour
|
||||
|
|
@ -104,19 +105,21 @@ public class ContextMenu : MonoBehaviour
|
|||
|
||||
public void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
var rect = transform as RectTransform;
|
||||
var pivot = rect.pivot;
|
||||
var canvas = Parent != null ? Parent.Canvas : Canvas;
|
||||
var mousePosition = Mouse.current.position.ReadValue();
|
||||
if (Parent!=null)
|
||||
pivot.x = ForceDirectionRight ? 0 : 1;
|
||||
else
|
||||
pivot.x = Input.mousePosition.x > Screen.width - rect.sizeDelta.x * canvas.scaleFactor ? 1 : 0;
|
||||
pivot.x = mousePosition.x > Screen.width - rect.sizeDelta.x * canvas.scaleFactor ? 1 : 0;
|
||||
var scaleFactor = canvas.scaleFactor;
|
||||
_dropdownRight = Input.mousePosition.x < Screen.width - rect.sizeDelta.x * scaleFactor * 2;
|
||||
var pivotTop = (Parent==null ? Input.mousePosition.y : ForcePosition.y) > (PaddingHeight + _options.Count * OptionHeight) * scaleFactor;
|
||||
_dropdownRight = mousePosition.x < Screen.width - rect.sizeDelta.x * scaleFactor * 2;
|
||||
var pivotTop = (Parent==null ? mousePosition.y : ForcePosition.y) > (PaddingHeight + _options.Count * OptionHeight) * scaleFactor;
|
||||
pivot.y = pivotTop ? 1 : 0;
|
||||
rect.pivot = pivot;
|
||||
rect.position = Parent!=null ? ForcePosition - (pivotTop ? Vector3.zero : Vector3.up * (OptionHeight * scaleFactor)) : Input.mousePosition;
|
||||
rect.position = Parent!=null ? ForcePosition - (pivotTop ? Vector3.zero : Vector3.up * (OptionHeight * scaleFactor)) : (Vector3)mousePosition;
|
||||
if (Parent==null)
|
||||
CancelClickCatcher.gameObject.SetActive(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
|
|
@ -10,12 +11,15 @@ using int2 = Unity.Mathematics.int2;
|
|||
|
||||
public class InventoryPanel : MonoBehaviour
|
||||
{
|
||||
public ActionGameManager GameManager;
|
||||
public ContextMenu ContextMenu;
|
||||
public TextMeshProUGUI Title;
|
||||
public Button Dropdown;
|
||||
public GridLayoutGroup Grid;
|
||||
public Sprite[] NodeTextures;
|
||||
public Prototype NodePrototype;
|
||||
|
||||
private Dictionary<int2, GameObject> _nodeInstances;
|
||||
private Dictionary<int2, GameObject> _nodeInstances = new Dictionary<int2, GameObject>();
|
||||
private int2[] _offsets = new[]
|
||||
{
|
||||
int2(0, 1),
|
||||
|
|
@ -28,8 +32,40 @@ public class InventoryPanel : MonoBehaviour
|
|||
int2(-1, 1)
|
||||
};
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Dropdown.onClick.AddListener(() =>
|
||||
{
|
||||
ContextMenu.Clear();
|
||||
foreach (var ship in GameManager.AvailableShips())
|
||||
{
|
||||
if (ship.CargoBays.Any())
|
||||
{
|
||||
ContextMenu.AddDropdown(ship.Name,
|
||||
ship.CargoBays
|
||||
.Select<EquippedCargoBay, (string text, Action action, bool enabled)>((bay, index) =>
|
||||
($"Bay {index}", () => Display(GameManager.ItemManager, bay), true))
|
||||
.Prepend(("Equipment", () => Display(GameManager.ItemManager, ship), true)));
|
||||
}
|
||||
else ContextMenu.AddOption(ship.Name, () => Display(GameManager.ItemManager, ship));
|
||||
}
|
||||
|
||||
foreach (var bay in GameManager.AvailableCargoBays())
|
||||
{
|
||||
ContextMenu.AddOption(bay.Name, () => Display(GameManager.ItemManager, bay));
|
||||
}
|
||||
ContextMenu.Show();
|
||||
});
|
||||
}
|
||||
|
||||
public void Display(ItemManager manager, Entity entity)
|
||||
{
|
||||
foreach(var node in _nodeInstances.Values)
|
||||
Destroy(node);
|
||||
_nodeInstances.Clear();
|
||||
|
||||
Title.text = entity.Name;
|
||||
|
||||
var hullData = manager.GetData(entity.Hull) as HullData;
|
||||
Grid.constraintCount = hullData.Shape.Width;
|
||||
_nodeInstances = hullData.Shape.AllCoordinates
|
||||
|
|
@ -90,12 +126,18 @@ public class InventoryPanel : MonoBehaviour
|
|||
|
||||
public void Display(ItemManager manager, EquippedCargoBay cargo)
|
||||
{
|
||||
Grid.constraintCount = cargo.Data.Shape.Width;
|
||||
_nodeInstances = cargo.Data.Shape.AllCoordinates
|
||||
foreach(var node in _nodeInstances.Values)
|
||||
Destroy(node);
|
||||
_nodeInstances.Clear();
|
||||
|
||||
Title.text = cargo.Name;
|
||||
|
||||
Grid.constraintCount = cargo.Data.InteriorShape.Width;
|
||||
_nodeInstances = cargo.Data.InteriorShape.AllCoordinates
|
||||
.ToDictionary(v => v,
|
||||
v =>
|
||||
{
|
||||
if (!cargo.Data.Shape[v])
|
||||
if (!cargo.Data.InteriorShape[v])
|
||||
{
|
||||
var empty = new GameObject("Empty Node", typeof(RectTransform));
|
||||
empty.transform.SetParent(Grid.transform);
|
||||
|
|
@ -106,7 +148,7 @@ public class InventoryPanel : MonoBehaviour
|
|||
var item = cargo.Occupancy[v.x, v.y];
|
||||
|
||||
bool ItemMatch(int2 offset) =>
|
||||
!cargo.Data.Shape[v + offset] ||
|
||||
!cargo.Data.InteriorShape[v + offset] ||
|
||||
item == null ||
|
||||
cargo.Occupancy[v.x + offset.x, v.y + offset.y] != item;
|
||||
|
||||
|
|
@ -127,10 +169,9 @@ public class InventoryPanel : MonoBehaviour
|
|||
var node = NodePrototype.Instantiate<Prototype>().gameObject;
|
||||
var image = node.GetComponentInChildren<Image>();
|
||||
image.sprite = NodeTextures[spriteIndex];
|
||||
var itemData = manager.GetData(item);
|
||||
if (item == null)
|
||||
image.color = Color.white * .5f;
|
||||
else if (itemData is EquippableItemData equippable)
|
||||
else if (manager.GetData(item) is EquippableItemData equippable)
|
||||
image.color = HardpointData.GetColor(equippable.HardpointType).ToColor();
|
||||
else
|
||||
image.color = Color.white;
|
||||
|
|
|
|||
Loading…
Reference in a new issue