Exemplo n.º 1
0
        void PopulateSceneFromGameMap()
        {
            var map = gameState.GameMap;

            for (int outer = 0; outer < map.Length; outer++)
            {
                for (int inner = 0; inner < map[outer].Length; inner++)
                {
                    var cell = map[outer][inner];
                    var x    = cell.X;
                    var y    = cell.Y;

                    instantiator.InstantiateBuildingsAtLocation(cell.Buildings, x, y);

                    //create list of player A missiles
                    var missilesPlayerA = new List <Missile>();
                    var missilesPlayerB = new List <Missile>();

                    //create list of player B missiles
                    if (cell.Missiles.Count > 0)
                    {
                        for (int m = 0; m < cell.Missiles.Count; m++)
                        {
                            if (cell.Missiles[m].PlayerType == PlayerType.A)
                            {
                                missilesPlayerA.Add(cell.Missiles[m]);
                            }
                            else
                            {
                                missilesPlayerB.Add(cell.Missiles[m]);
                            }
                        }
                    }

                    instantiator.InstantiateMissileAtLocation(missilesPlayerA, x, y, rate);
                    instantiator.InstantiateMissileAtLocation(missilesPlayerB, x, y, rate);

                    if (currentRound == startRound)
                    {
                        instantiator.InstantiateGroundTile(inner, outer, cell.CellOwner);
                    }
                }
            }
        }
        private void PopulateSceneFromGameMap()
        {
            var map = gameState.GameMap;

            for (int outer = 0; outer < map.Length; outer++)
            {
                for (int inner = 0; inner < map[outer].Length; inner++)
                {
                    var cell = map [outer] [inner];
                    var x    = cell.X;
                    var y    = cell.Y;

                    instantiator.InstantiateBuildingsAtLocation(cell.Buildings, x, y);
                    instantiator.InstantiateMissileAtLocation(cell.Missiles, x, y, 0.5f);

                    // Map is orientated vertically, with inner objects having x, y related to that
                    //	orientation. We want to orientate horizontally for easier use in Editor.
                    //	inner = x
                    //	outer = y
                    instantiator.InstantiateGroundTile(inner, outer);
                }
            }
        }