Esempio n. 1
0
        private void BuildGraph(AttackGraph graph, List <Ant> ours, List <Ant> theirs, TacticalMap map)
        {
            for (int i = 0; i < ours.Count; i++)
            {
                Ant myAnt = ours[i];

                //
                //  Get all tiles on tactical map that our ant can navigate on
                //
                IEnumerable <TacticalMap.Tile> tiles =
                    Vector2i.AllDirections
                    .Select(direction => Vector2i.Wrap(myAnt.position + direction, map.Width, map.Height))
                    .Select(p => map[p.x, p.y]);
                //
                //  Identify enemies
                //
                IEnumerable <int> enemies = IdentifyEnemies(tiles);

                foreach (int enemyId in enemies)
                {
                    graph.AddNodeGroup(i, enemyId, BuildLinksAssociatedToEnemy(enemyId, tiles));
                }
            }
        }
Esempio n. 2
0
 public AttackManager(GameState state)
 {
     map = new TacticalMap(state.Width, state.Height, state.AttackRadius2);
 }