Ejemplo n.º 1
0
        public List<int> setCrewDictionary(int shipUID)
        {
            Ship thisShip = (Ship)ShipManager.RetrieveEntity(shipUID);

            // roomShipKeys: current room UIDs in current ship
            List<int> roomShipKeys = new List<int>();

            // gridRoomKeys: current grid UIDs in rooms on current ship
            List<int> gridRoomKeys = new List<int>();

            // This is looping over every room that exists.
            //System.Diagnostics.Debug.WriteLine("RoomToShip: " + RoomToShip.Keys.Count.ToString());
            foreach (int i in RoomToShip.Keys)
            {
                if (RoomToShip[i] == shipUID)
                {
                    //System.Diagnostics.Debug.WriteLine("This is getting the rooms: "+i.ToString());
                    roomShipKeys.Add(i);
                }
            }

            // This is looping over Grids in every room that exists.
            foreach (int i in GridToRoom.Keys)
            {
                if (roomShipKeys.Contains(GridToRoom[i]))
                {
                    //System.Diagnostics.Debug.WriteLine("This is getting the grids: " + i.ToString());
                    gridRoomKeys.Add(i);
                }
            }

            int mans = 0;
            List<int> filledRoomUIDs = new List<int>();
            foreach (int i in gridRoomKeys)
            {
                if (mans == 3)
                {
                    break;
                }

                Grid thisGrid = (Grid)GridManager.RetrieveEntity(i);

                Crew newguy = new Crew(thisGrid.Sprite.Position2D, thisGrid.GridPosition, crewNoAnimate, crewNoAnimate);

                int crewUID = CrewManager.AddEntity(newguy);

                CrewToShip[crewUID] = shipUID;
                CrewToRoom[crewUID] = GridToRoom[i];
                filledRoomUIDs.Add(i);

                mans++;
            }

            return filledRoomUIDs;
        }
Ejemplo n.º 2
0
        public List <int> setCrewDictionary(int shipUID)
        {
            Ship thisShip = (Ship)ShipManager.RetrieveEntity(shipUID);



            // roomShipKeys: current room UIDs in current ship
            List <int> roomShipKeys = new List <int>();

            // gridRoomKeys: current grid UIDs in rooms on current ship
            List <int> gridRoomKeys = new List <int>();


            // This is looping over every room that exists.
            //System.Diagnostics.Debug.WriteLine("RoomToShip: " + RoomToShip.Keys.Count.ToString());
            foreach (int i in RoomToShip.Keys)
            {
                if (RoomToShip[i] == shipUID)
                {
                    //System.Diagnostics.Debug.WriteLine("This is getting the rooms: "+i.ToString());
                    roomShipKeys.Add(i);
                }
            }

            // This is looping over Grids in every room that exists.
            foreach (int i in GridToRoom.Keys)
            {
                if (roomShipKeys.Contains(GridToRoom[i]))
                {
                    //System.Diagnostics.Debug.WriteLine("This is getting the grids: " + i.ToString());
                    gridRoomKeys.Add(i);
                }
            }


            int mans = 0;

            List <int> filledRoomUIDs = new List <int>();

            foreach (int i in gridRoomKeys)
            {
                if (mans == 3)
                {
                    break;
                }

                Grid thisGrid = (Grid)GridManager.RetrieveEntity(i);

                Crew newguy = new Crew(thisGrid.Sprite.Position2D, thisGrid.GridPosition, crewNoAnimate, crewNoAnimate);

                int crewUID = CrewManager.AddEntity(newguy);

                CrewToShip[crewUID] = shipUID;
                CrewToRoom[crewUID] = GridToRoom[i];

                filledRoomUIDs.Add(i);


                mans++;
            }



            return(filledRoomUIDs);
        }