Exemplo n.º 1
0
        public void MovingUnit_WillUpdateHexTypes()
        {
            CrossPlayerController.MoveUnit(m_Unit0, new[] { new int2(1, 0) }, new int2(1, 0));

            var hex0 = HexDatabase.GetHex(new int2(0, 0));
            var hex1 = HexDatabase.GetHex(new int2(1, 0));

            Assert.AreEqual(HexType.Empty, hex0.Type, "Hex0 had incorrect type");
            Assert.AreEqual(HexType.Unit, hex1.Type, "Hex1 had incorrect type");
        }
Exemplo n.º 2
0
        private void OnTurnStarted(Selectable obj)
        {
            if (obj.Team != LocalTeam)
            {
                return;
            }

            if (obj is Unit unit)
            {
                var Paths = HexPathfinder.FindAllPaths(unit.Cell, HexType.Empty, unit.Movement);

                var possibleDestinations = Paths.Keys;
                var index        = new Random().Next(0, possibleDestinations.Count - 1);
                var cellToMoveTo = possibleDestinations.ElementAt(index);

                var path = Paths.CalculatePathArray(cellToMoveTo);
                CrossPlayerController.MoveUnit(unit, path, cellToMoveTo);
            }
        }