public SlotOverlay(VirtualController.Button b, Rectangle m, Color c, SlotShape shape) : base(b) { Metrics = m; Color = c; Shape = shape; }
public SlotOverlay(VirtualController.Axis a, bool isPos, Rectangle m, Color c, SlotShape shape) : base(a, isPos) { Metrics = m; Color = c; Shape = shape; }
public void InventoryItemRotation() { SlotShape ss = new SlotShape(new int[, ] { { 1 }, // (0,0) { 1 }, // (0,1) { 1 } // (0,2) }); InventoryItem i = new InventoryItem(ss); // Rotate Pivot Origin (0,0) -> (0,0)(1,0)(2,0) i.Rotate(new Vector2(0, 0), 1); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 0)), i.ToString()); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(1, 0)), i.ToString()); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(2, 0)), i.ToString()); // Rotate Pivot (0,1) -> (-1,1)(0,1)(1,1) i = new InventoryItem(ss); i.Rotate(new Vector2(0, 1), -1); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(-1, 1)), i.ToString()); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 1)), i.ToString()); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(1, 1)), i.ToString()); // Rotate Pivot (0,2) -> (-2, 2)(-1, 2)(0,2) i = new InventoryItem(ss); i.Rotate(new Vector2(0, 2), 1); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(-2, 2)), i.ToString()); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(-1, 2)), i.ToString()); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 2)), i.ToString()); }
public void Init(SlotShape slotShape) { itemSlots = SlotShape.FilterPoints(slotShape); GetComponent <RectTransform>().sizeDelta = new Vector2(slotShape.Shape.GetLength(1) * 50, slotShape.Shape.GetLength(0) * 50); GetComponent <Image>().sprite = sprite; }
public void SlotShapeTest_3Dimensions() { SlotShape ss = new SlotShape(new int[, , ] { { // Layer 1 { 1, 1 }, { 1, 1 } }, { // Layer 2 { 1, 1 }, { 1, 1 } } }); Assert.AreEqual(8, ss.slotPoints.Count); // Layer 1 Assert.True(ss.slotPoints.Contains(new IntVector3(0, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 1, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 1, 0))); // Layer 2 Assert.True(ss.slotPoints.Contains(new IntVector3(0, 0, 1))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 0, 1))); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 1, 1))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 1, 1))); }
public void SlotShapeTest_2Dimensions() { SlotShape ss = new SlotShape(new int[, , ] { { { 0, 0 }, { 0, 0 } } }); Assert.Zero(ss.slotPoints.Count); ss = new SlotShape(new int[, , ] { { { 1, 1 }, { 1, 1 } } }); Assert.AreEqual(4, ss.slotPoints.Count); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 1, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 1, 0))); }
// Creates an inventory with the following slotShape public Inventory(SlotShape slotShape) { _inventorySlots = new InventorySlot[slotShape.Shape.GetLength(0), slotShape.Shape.GetLength(1)]; PopulateInventory(slotShape); }
public void InventoryItemRotation() { SlotShape ss = new SlotShape(new int[, ] { { 1 }, // (0,0) { 1 }, // (0,1) { 1 } // (0,2) }); var ii = new GameObject().AddComponent <InventoryItemUI>(); ii.GetComponent <InventoryItemUI>().Init(ss); // Rotate Pivot Origin (0,0) -> (0,0)(1,0)(2,0) ii.Rotate(new Vector2(0, 0), 1); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(0, 0)), ii.ToString()); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(1, 0)), ii.ToString()); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(2, 0)), ii.ToString()); // Rotate Pivot (0,1) -> (-1,1)(0,1)(1,1) ii = new GameObject().AddComponent <InventoryItemUI>(); ii.GetComponent <InventoryItemUI>().Init(ss); ii.Rotate(new Vector2(0, 1), -1); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(-1, 1)), ii.ToString()); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(0, 1)), ii.ToString()); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(1, 1)), ii.ToString()); // Rotate Pivot (0,2) -> (-2, 2)(-1, 2)(0,2) ii = new GameObject().AddComponent <InventoryItemUI>(); ii.GetComponent <InventoryItemUI>().Init(ss); ii.Rotate(new Vector2(0, 2), 1); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(-2, 2)), ii.ToString()); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(-1, 2)), ii.ToString()); Assert.AreEqual(true, ii.itemSlots.Contains(new Vector2(0, 2)), ii.ToString()); }
public void InventoryItemClassTests() { SlotShape ss = new SlotShape(new int[, ] { { 1 }, { 1 } }); InventoryItem i = new InventoryItem(ss); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 0))); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 1))); ss = new SlotShape(new int[, ] { { 0, 1 }, { 1, 0 } }); i = new InventoryItem(ss); Assert.AreEqual(2, i.itemSlots.Count); Assert.AreEqual(false, i.itemSlots.Contains(new Vector2(0, 0))); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(1, 0))); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 1))); Assert.AreEqual(false, i.itemSlots.Contains(new Vector2(1, 1))); }
public void CreatingInventoryItemUI() { SlotShape ss = new SlotShape(new int[, ] { { 1 }, { 1 } }); var i = new GameObject().AddComponent <InventoryItemUI>(); i.GetComponent <InventoryItemUI>().Init(ss); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 0))); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 1))); ss = new SlotShape(new int[, ] { { 0, 1 }, { 1, 0 } }); i = new GameObject().AddComponent <InventoryItemUI>(); i.GetComponent <InventoryItemUI>().Init(ss); Assert.AreEqual(2, i.itemSlots.Count); Assert.AreEqual(false, i.itemSlots.Contains(new Vector2(0, 0))); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(1, 0))); Assert.AreEqual(true, i.itemSlots.Contains(new Vector2(0, 1))); Assert.AreEqual(false, i.itemSlots.Contains(new Vector2(1, 1))); }
private void Start() { slotShape = new SlotShape(new int[, ] { { 1 }, { 1 } }); Init(slotShape); }
int CountSlotsAllStages(SlotColor color, SlotShape shape) { int count = 0; for (int i = 0; i <= mPreviousSlots.Count - 2; i++) { count += mPreviousSlots[i].Count(s => s.color == color && s.shape == shape); } return(count); }
public void GenerateInventory(SlotShape slotShape) { inventorySlots = new InventorySlot[slotShape.slotShape.GetLength(0), slotShape.slotShape.GetLength(1), slotShape.slotShape.GetLength(2)]; foreach (IntVector3 position in slotShape.slotPoints) { CreateInventorySlot(position); } }
public void Init(SlotShape slotShape) { _inventorySlots = new InventorySlotUI[slotShape.Shape.GetLength(0), slotShape.Shape.GetLength(1)]; slotSize = _inventorySlotPrefab.GetComponent <RectTransform>().sizeDelta.x; if (transform.GetComponent <RectTransform>() != null) { _dimensions = new Vector2(slotShape.Shape.GetLength(1) * slotSize, slotShape.Shape.GetLength(0) * slotSize); transform.GetComponent <RectTransform>().sizeDelta = _dimensions; } PopulateInventory(slotShape); }
private void Start() { SlotShape ss = new SlotShape(new int[, ] { { 1, 0, 1, 1, 1, 1, 1 }, { 1, 0, 1, 1, 1, 1, 1 }, { 0, 0, 0, 1, 1, 1, 0 }, { 1, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1 } }); Init(ss); }
private void SetupButton(VirtualController.Button button, Panel panel) { string name = button.ToString(); SlotShape shape = SlotShape.Rounded; if (panel.Tag is string) { try { shape = (SlotShape)Enum.Parse(typeof(SlotShape), panel.Tag as string); } catch (FormatException) { } } RegisterOverlay(button, panel.Bounds, panel.BackColor, shape); panel.Tag = button; panel.Hide(); }
// Gets necessary points from the slot shape to only include relevant points // ie) in the case of { 0, 0, 1} only point (2, 0) is relevant 'cause the first two are empty // ---------------------------^ this point public static List <Vector2> FilterPoints(SlotShape slotShape) { List <Vector2> gridSlots = new List <Vector2>(); for (int y = 0; y < slotShape.Shape.GetLength(0); y++) { for (int x = 0; x < slotShape.Shape.GetLength(1); x++) { if (slotShape.IsOpenSlot(x, y)) { gridSlots.Add(new Vector2(x, y)); } } } return(gridSlots); }
public void InventoryClassTests() { SlotShape ss = new SlotShape(new int[, ] { { 1, 0, 1 }, { 0, 1, 0 }, { 1, 0, 1 } }); Inventory inv = new Inventory(ss); Assert.AreEqual(ss.ToString(), inv.ToString(), inv.ToString()); Assert.AreNotEqual(null, inv.GetSlotAt(0, 0)); Assert.AreEqual(null, inv.GetSlotAt(1, 0)); Assert.AreNotEqual(null, inv.GetSlotAt(2, 0)); Assert.AreEqual(null, inv.GetSlotAt(0, 1)); Assert.AreNotEqual(null, inv.GetSlotAt(1, 1)); Assert.AreEqual(null, inv.GetSlotAt(2, 1)); Assert.AreNotEqual(null, inv.GetSlotAt(0, 2)); Assert.AreEqual(null, inv.GetSlotAt(1, 2)); Assert.AreNotEqual(null, inv.GetSlotAt(2, 2)); }
public void SlotShapeTests() { SlotShape ss = new SlotShape(); Assert.AreEqual("[ ]\n", ss.ToString()); ss = new SlotShape(new int[, ] { { 1, 0, 1 } }); Assert.AreEqual("[ ] [ ]\n", ss.ToString()); ss = new SlotShape(new int[, ] { { 1 }, { 0 }, { 1 } }); Assert.AreEqual("[ ]\n \n[ ]\n", ss.ToString()); ss = new SlotShape(new int[, ] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } }); Assert.AreEqual("[ ][ ][ ]\n[ ][ ][ ]\n[ ][ ][ ]\n", ss.ToString()); ss = new SlotShape(new int[, ] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }); Assert.AreEqual(" \n \n \n", ss.ToString()); ss = new SlotShape(new int[, ] { { 1, 0, 1 }, { 0, 1, 0 }, { 1, 0, 1 } }); Assert.AreEqual(true, ss.IsOpenSlot(0, 0)); Assert.AreEqual(false, ss.IsOpenSlot(1, 0)); Assert.AreEqual(true, ss.IsOpenSlot(2, 0)); Assert.AreEqual(false, ss.IsOpenSlot(0, 1)); Assert.AreEqual(true, ss.IsOpenSlot(1, 1)); Assert.AreEqual(false, ss.IsOpenSlot(2, 1)); Assert.AreEqual(true, ss.IsOpenSlot(0, 2)); Assert.AreEqual(false, ss.IsOpenSlot(1, 2)); Assert.AreEqual(true, ss.IsOpenSlot(2, 2)); }
// Populates Inventory with InventorySlots along the possible areas of the slotShape used. // Creating A Slot: SlotShape --- InventorySlot // { 1 1 1 } [ ] [ ] [ ] // { 1 1 1 } ---> [ ] [ ] [ ] = 7 created Slots // { 0 1 0 } ... [ ] ... private int PopulateInventory(SlotShape slotShape) { int slotsCreated = 0; for (int y = 0; y < _inventorySlots.GetLength(0); y++) { for (int x = 0; x < _inventorySlots.GetLength(1); x++) { if (slotShape.IsOpenSlot(x, y)) { if (CreateInventorySlot(x, y)) { slotsCreated++; } } } } return(slotsCreated); }
private void Start() { endScale = transform.localScale; transform.localScale = Vector3.zero; SlotShape ss = new SlotShape(new int[, , ] { { // Layer 1 { 1, 1, 1 }, { 1, 1, 1 }, }, { // Layer 2 { 1, 1, 1 }, { 1, 1, 1 }, } }); GenerateInventory(ss); gameObject.SetActive(false); }
public void SlotShapeTest_NoDimensions() { SlotShape ss = new SlotShape(new int[, , ] { {} }); Assert.Zero(ss.slotPoints.Count); /* * ss = new SlotShape(new int[,,] * { * {{1,1}, {1,1}}, * {{1,1}, {1,1}} * }); * * * * Assert.AreEqual(8, ss.slotPoints.Count); */ }
private void SetupAxisGesture(AxisGesture ag, Panel panel) { VirtualController.Axis stick = Util.StickFromGesture(ag), axis = Util.AxisFromGesture(ag); bool pos = Util.PoleFromGesture(ag); SlotShape shape = SlotShape.Rounded; if (panel.Tag is string) { try { shape = (SlotShape)Enum.Parse(typeof(SlotShape), panel.Tag as string); } catch (FormatException) { } } AxisActions.Gestures axisGesture = pos ? AxisActions.Gestures.Positive : AxisActions.Gestures.Negative; RegisterOverlay(axis, pos, panel.Bounds, panel.BackColor, shape); panel.Hide(); panel.Tag = ag; }
public void CreatingInventoryManagerTests() { SlotShape ss = new SlotShape(new int[, ] { { 1, 0, 1 }, { 0, 1, 0 }, { 1, 0, 1 } }); var inv = new GameObject().AddComponent <InventoryManager>(); var inventorySlotPrefab = (GameObject)Resources.Load("Tests/InventorySlot"); inv.Construct(inventorySlotPrefab); inv.GetComponent <InventoryManager>().Init(ss); Assert.AreEqual(ss.ToString(), inv.ToString(), inv.ToString()); Assert.AreNotEqual(null, inv.GetSlotAt(0, 0)); Assert.AreEqual(null, inv.GetSlotAt(1, 0)); Assert.AreNotEqual(null, inv.GetSlotAt(2, 0)); Assert.AreEqual(null, inv.GetSlotAt(0, 1)); Assert.AreNotEqual(null, inv.GetSlotAt(1, 1)); Assert.AreEqual(null, inv.GetSlotAt(2, 1)); Assert.AreNotEqual(null, inv.GetSlotAt(0, 2)); Assert.AreEqual(null, inv.GetSlotAt(1, 2)); Assert.AreNotEqual(null, inv.GetSlotAt(2, 2)); }
public void InventorySpaceCheck() { SlotShape ss = new SlotShape(new int[, ] { { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 } }); var inv = new GameObject().AddComponent <InventoryManager>(); var inventorySlotPrefab = (GameObject)Resources.Load("Tests/InventorySlot"); inv.Construct(inventorySlotPrefab); inv.GetComponent <InventoryManager>().Init(ss); for (int y = 0; y < 3; y++) { for (int x = 0; x < 5; x++) { // Everything should be free Assert.AreEqual(true, inv.IsSlotFree(new Vector2(x, y)), inv.GetSlotAt(x, y).ToString()); } } ss = new SlotShape(new int[, ] { { 1, 1, 1, 1, 1 }, { 1, 1, 0, 1, 1 }, { 1, 1, 1, 1, 1 } }); inv = new GameObject().AddComponent <InventoryManager>(); inv.Construct(inventorySlotPrefab); inv.GetComponent <InventoryManager>().Init(ss); // One space is unavailable therefore it should be null and return false Assert.AreEqual(false, inv.IsSlotFree(new Vector2(2, 1))); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Inventory inventory = (Inventory)target; if (GUILayout.Button("Generate Inventory Slots")) { SlotShape ss = new SlotShape(new int[, , ] { { // Layer 1 { 1, 1 }, { 1, 1 }, { 1, 1 } }, { // Layer 2 { 1, 1 }, { 1, 1 }, { 1, 1 } } }); inventory.GenerateInventory(ss); } }
public void SlotShapeTest_1Dimension() { SlotShape ss = new SlotShape(new int[, , ] { { { 0 } } }); Assert.Zero(ss.slotPoints.Count); ss = new SlotShape(new int[, , ] { { { 1 } } }); Assert.AreEqual(1, ss.slotPoints.Count); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 0, 0))); ss = new SlotShape(new int[, , ] { { { 1, 1, 1 } } }); Assert.AreEqual(3, ss.slotPoints.Count); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(1, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(2, 0, 0))); ss = new SlotShape(new int[, , ] { { { 1, 0, 1 } } }); Assert.AreEqual(2, ss.slotPoints.Count); Assert.True(ss.slotPoints.Contains(new IntVector3(0, 0, 0))); Assert.False(ss.slotPoints.Contains(new IntVector3(1, 0, 0))); Assert.True(ss.slotPoints.Contains(new IntVector3(2, 0, 0))); }
public void InventorySpaceCheck() { SlotShape ss = new SlotShape(new int[, ] { { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 } }); Inventory i = new Inventory(ss); List <Vector2> inventorySlotsToCheck = new List <Vector2>(); for (int y = 0; y < 3; y++) { for (int x = 0; x < 5; x++) { inventorySlotsToCheck.Add(new Vector2(x, y)); } } // Everything should be free Assert.AreEqual(true, i.AreSlotsFree(inventorySlotsToCheck)); ss = new SlotShape(new int[, ] { { 1, 1, 1, 1, 1 }, { 1, 1, 0, 1, 1 }, { 1, 1, 1, 1, 1 } }); i = new Inventory(ss); // One space is unavailable therefore it should be null and return false Assert.AreEqual(false, i.AreSlotsFree(inventorySlotsToCheck)); }
public void RegisterOverlay(VirtualController.Button b, Rectangle m, Color c, SlotShape shape) { slotOverlays.Add(new SlotOverlay(b, m, c, shape)); }
public void InventorySpaceAfterAddingItem() { SlotShape ss = new SlotShape(new int[, ] { { 1, 1, 1, 1, 1 }, { 1, 1, 0, 1, 1 }, { 1, 1, 1, 1, 1 } }); var inv = new GameObject().AddComponent <InventoryManager>(); var inventorySlotPrefab = (GameObject)Resources.Load("Tests/InventorySlot"); inv.Construct(inventorySlotPrefab); inv.GetComponent <InventoryManager>().Init(ss); ss = new SlotShape(new int[, ] { { 1, 1 }, { 1, 1 } }); var ii = new GameObject().AddComponent <InventoryItemUI>(); ii.GetComponent <InventoryItemUI>().Init(ss); // Attempt #1 = Add Success // Before Adding Item Assert.AreEqual(true, inv.IsSlotFree(new Vector2(0, 0)), "A1 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(1, 0)), "A1 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(0, 1)), "A1 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(1, 1)), "A1 Before Adding..."); // Adding Item Assert.AreEqual(true, inv.AddItemAtSlot(ii, 0, 0), "A1 Adding..."); // After Adding Item Assert.AreEqual(false, inv.IsSlotFree(new Vector2(0, 0)), "A1 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(1, 0)), "A1 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(0, 1)), "A1 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(1, 1)), "A1 After Adding..."); // Attempt #2 = Add Fail // Before Adding Item Assert.AreEqual(false, inv.IsSlotFree(new Vector2(1, 0)), "A2 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(2, 0)), "A2 Before Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(1, 1)), "A2 Before Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(2, 1)), "A2 Before Adding..."); // Adding Item Assert.AreEqual(false, inv.AddItemAtSlot(ii, 1, 0), "A2 Adding..."); // After Adding Item Assert.AreEqual(false, inv.IsSlotFree(new Vector2(1, 0)), "A2 After Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(2, 0)), "A2 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(1, 1)), "A2 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(2, 1)), "A2 After Adding..."); // Attempt #3 = Add At Different Location + Success // Before Adding Item Assert.AreEqual(true, inv.IsSlotFree(new Vector2(3, 0)), "A3 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(4, 0)), "A3 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(3, 1)), "A3 Before Adding..."); Assert.AreEqual(true, inv.IsSlotFree(new Vector2(4, 1)), "A3 Before Adding..."); // Adding Item Assert.AreEqual(true, inv.AddItemAtSlot(ii, 3, 0), "A3 Adding..."); // After Adding Item Assert.AreEqual(false, inv.IsSlotFree(new Vector2(3, 0)), "A3 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(4, 0)), "A3 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(3, 1)), "A3 After Adding..."); Assert.AreEqual(false, inv.IsSlotFree(new Vector2(4, 1)), "A3 After Adding..."); // Attempt #4 = Add Index Out Of Range Assert.AreEqual(false, inv.AddItemAtSlot(ii, 3, 2), "A4 Adding..."); // Attempt #5 = Adding More... ss = new SlotShape(new int[, ] { { 1, 1 } }); ii = new GameObject().AddComponent <InventoryItemUI>(); ii.GetComponent <InventoryItemUI>().Init(ss); Assert.AreEqual(true, inv.AddItemAtSlot(ii, 1, 2), "A5 Adding..."); // Attempt #6 = Irregular Shape.. // Reset Inventory ss = new SlotShape(new int[, ] { { 1, 1, 1, 1, 1 }, { 1, 1, 0, 1, 1 }, { 1, 1, 1, 1, 1 } }); inv = new GameObject().AddComponent <InventoryManager>(); inv.Construct(inventorySlotPrefab); inv.GetComponent <InventoryManager>().Init(ss); ss = new SlotShape(new int[, ] { { 1, 1, 0, 0, 0 }, { 1, 1, 0, 0, 0 }, { 1, 1, 1, 1, 0 } }); ii = new GameObject().AddComponent <InventoryItemUI>(); ii.GetComponent <InventoryItemUI>().Init(ss); Assert.AreEqual(false, inv.AddItemAtSlot(ii, 1, 0), "A6 Adding..."); Assert.AreEqual(true, inv.AddItemAtSlot(ii, 0, 0), "A6 Adding..."); }
public void RegisterOverlay(VirtualController.Axis a, bool isPos, Rectangle m, Color c, SlotShape shape) { slotOverlays.Add(new SlotOverlay(a, isPos, m, c, shape)); }
public Slot(SlotShape shape, SlotColor color, float position) { this.shape = shape; this.color = color; this.position = position; }