Пример #1
0
        private void ProcessKeyboard(GameTime gameTime)
        {
            if (InputHelper.IsKeyPressed(Keys.Space))
            {
                //GameObjects.Colony newColony = new GameObjects.Colony();
                //newColony._Position = InputHelper.MouseWorldPos;
                //newColony.LoadContent(@"Art/Fire", Content);
                //ColonyList.Add(newColony);
                Console.WriteLine(InputHelper.MouseWorldPos);
            }

            //if (InputHelper.IsKeyPressed(Keys.H))
            //{
            //    GameObjects.Colony newColony = new GameObjects.Colony();
            //    newColony._Position = InputHelper.MouseWorldPos;
            //    newColony.LoadContent(@"Art/LavaTile", Content);
            //    BadColonies.Add(newColony);
            //}

            if (InputHelper.IsKeyPressed(Keys.Q))
            {
                if (currentQueens >= 1)
                {
                    currentQueens--;
                    GameObjects.Queen nq = new GameObjects.Queen();
                    nq.LoadContent(@"Art/FishItem", Content);
                    nq._Position = InputHelper.MouseWorldPos;
                    nq.myTeam    = GameObjects.Colony.AntTeams.kTeamGreen;
                    QueenList.Add(nq);

                    GameObjects.Colony closestColony = ColonyList[0];

                    foreach (GameObjects.Colony c in ColonyList)
                    {
                        if (Vector2.Distance(nq._Position, closestColony._Position) > Vector2.Distance(nq._Position, c._Position))
                        {
                            closestColony = c;
                        }
                    }

                    nq.SetColony(closestColony);
                }
            }
        }
Пример #2
0
 public void SetColony(Colony c)
 {
     targetColony = c;
 }