private void UpdatePositions() { var positions = PoolPositionUtility.GetAllIndices(); foreach (var i in positions) { var position = UiPool.GetPosition(i); position.transform.position = Positioning.GetPositionFor(i); } }
void IRevealPool.OnRevealPool(IPool <CardPool> pool) { var positions = PoolPositionUtility.GetAllIndices(); foreach (var i in positions) { var cardPool = pool.GetCardAt(i); UiPool.AddCard(cardPool, i); } }
private void FillPool() { var card = GetTestCard(); var positions = PoolPositionUtility.GetAllIndices(); //fill pool foreach (var i in positions) { _pool.AddCardAt(card, i); } }
public void AddCardAt_Test() { var card = GetTestCard(); var positions = PoolPositionUtility.GetAllIndices(); foreach (var i in positions) { _pool.AddCardAt(card, i); Assert.AreEqual(card, _pool.GetCardAt(i)); } }
public void EmptyPool_Test() { FillPool(); _pool.Clear(); var positions = PoolPositionUtility.GetAllIndices(); Assert.IsTrue(_pool.Size() == 0); foreach (var i in positions) { Assert.AreEqual(null, _pool.GetCardAt(i)); } }
public void RemoveCardAt_Test() { FillPool(); var positions = PoolPositionUtility.GetAllIndices(); foreach (var i in positions) { _pool.RemoveCardAt(i); } foreach (var i in positions) { Assert.AreEqual(null, _pool.GetCardAt(i)); } }
private PositionId?FindEmpty() { var pool = Game.Pool; var positions = PoolPositionUtility.GetAllIndices(); for (var i = positions.Length - 1; i >= 0; i--) { if (!pool.HasDataAt(positions[i])) { return(positions[i]); } } return(null); }
private void RevealPool() { var library = Game.Library; var pool = Game.Pool; var positions = PoolPositionUtility.GetAllIndices(); foreach (var i in positions) { var data = library.GetRandomData(); var cardPool = new CardPool(data); pool.AddCardAt(cardPool, i); } OnRevealPool(pool); }
private void DrawBoundaries() { if (Positioning == null) { Positioning = new UiPoolPositioning(uiPool); } else { Positioning.Update(); } DrawSquare(); var positions = PoolPositionUtility.GetAllIndices(); Gizmos.color = Color.green; foreach (var i in positions) { var center = Positioning.GetPositionFor(i); uiPool.GetPosition(i).transform.position = center; Gizmos.DrawCube(center, Positioning.Size); } }