Пример #1
0
        private void UpdatePositions()
        {
            var positions = PoolPositionUtility.GetAllIndices();

            foreach (var i in positions)
            {
                var position = UiPool.GetPosition(i);
                position.transform.position = Positioning.GetPositionFor(i);
            }
        }
Пример #2
0
        void IRevealPool.OnRevealPool(IPool <CardPool> pool)
        {
            var positions = PoolPositionUtility.GetAllIndices();

            foreach (var i in positions)
            {
                var cardPool = pool.GetCardAt(i);
                UiPool.AddCard(cardPool, i);
            }
        }
Пример #3
0
        private void FillPool()
        {
            var card      = GetTestCard();
            var positions = PoolPositionUtility.GetAllIndices();

            //fill pool
            foreach (var i in positions)
            {
                _pool.AddCardAt(card, i);
            }
        }
Пример #4
0
        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));
            }
        }
Пример #5
0
        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));
            }
        }
Пример #6
0
        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));
            }
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
            }
        }