Пример #1
0
 private void CreateWalkers(MapWalkersRouter router, MapWalkerData data, Vector2Int position, int count)
 {
     for (var i = 0; i < count; i++)
     {
         router.CreateWalker(data, position);
     }
 }
Пример #2
0
        public void TryCreateWalker(float chance, MapWalkerData data, int maxCount)
        {
            if (CheckChance(chance) == false)
            {
                return;
            }

            if (_walkers.Count >= maxCount)
            {
                return;
            }

            var index = Random.Range(0, _walkers.Count);

            CreateWalker(data, _walkers[index].Position);
        }
Пример #3
0
 public MapWalker(MapWalkerData data, Vector2Int position, RectInt borders)
 {
     _data    = data ? data : throw new ArgumentException("Map Walker Data is invalid!");
     _borders = borders;
     Position = position;
 }
Пример #4
0
        public void CreateWalker(MapWalkerData data, Vector2Int position)
        {
            var walker = new MapWalker(data, position, _borders);

            _walkers.Add(walker);
        }