コード例 #1
0
 public void EndTurn(int amountOfScience)
 {
     science += amountOfScience;
     if (techResearching == Tech.Attack)
     {
         if (science >= (attackTechsResearched + 1) * 300)
         {
             science -= (attackTechsResearched + 1) * 300;
             attackTechsResearched++;
             newTechsResearched.Add("Attack");
             techResearching = Tech.None;
         }
     }
     if (techResearching == Tech.Defense)
     {
         if (science >= (defenseTechsResearched + 1) * 300)
         {
             science -= (defenseTechsResearched + 1) * 300;
             defenseTechsResearched++;
             newTechsResearched.Add("Defense");
             techResearching = Tech.None;
         }
     }
     if (techResearching == Tech.Movement)
     {
         if (science >= (movementTechsResearched + 1) * 300)
         {
             science -= (movementTechsResearched + 1) * 300;
             movementTechsResearched++;
             newTechsResearched.Add("Movement");
             techResearching = Tech.None;
         }
     }
 }
コード例 #2
0
 private void searchID(Tech one)//goes through the tech tree to see if the sourceID is complete
 {
     for (int x = 0; x < Economic.Count(); x++)
     {
         one.avaliable(Economic.ElementAt(x));
         if (one.getSelectable() == true)
         {
             break;
         }
     }
     for (int x = 0; x < Construction.Count(); x++)
     {
         one.avaliable(Construction.ElementAt(x));
         if (one.getSelectable() == true)
         {
             break;
         }
     }
     for (int x = 0; x < Military.Count(); x++)
     {
         one.avaliable(Military.ElementAt(x));
         if (one.getSelectable() == true)
         {
             break;
         }
     }
 }
コード例 #3
0
        public void Initialize()
        {
            attackTechsResearched   = 0;
            defenseTechsResearched  = 0;
            movementTechsResearched = 0;

            science = 0;

            techResearching = Tech.None;

            newTechsResearched = new List <string>();
        }
コード例 #4
0
        public void avaliable(object tch2)//check if the tech with ID that = SourceID is complete
        {
            Tech tec2 = (Tech)tch2;

            if (tec2.getID() == SourceID && tec2.done() == true)
            {
                selectable = true;
            }
            else
            {
                selectable = false;
            }
        }
コード例 #5
0
        public void Update(KeyboardState kb, KeyboardState oldKb, MouseState mouse, MouseState oldMouse)
        {
            SelectableT();
            SelectReset();
            if (kb.IsKeyDown(Keys.T) && kb != oldKb && Open == false)
            {
                Open = true;
            }
            else if (kb.IsKeyDown(Keys.T) && kb != oldKb && Open == true)
            {
                Open = false;
            }

            if (mouse.LeftButton == ButtonState.Pressed &&
                oldMouse.LeftButton == ButtonState.Released &&
                mouse.X >= 110 && mouse.X <= 830 &&
                mouse.Y >= 115 && mouse.Y <= 220 &&
                Open == true)
            {
                menuState = GameState.Con;
            }
            if (mouse.LeftButton == ButtonState.Pressed &&
                oldMouse.LeftButton == ButtonState.Released &&
                mouse.X >= 110 && mouse.X <= 830 &&
                mouse.Y >= 235 && mouse.Y <= 340 &&
                Open == true)
            {
                menuState = GameState.Eco;
            }
            if (mouse.LeftButton == ButtonState.Pressed &&
                oldMouse.LeftButton == ButtonState.Released &&
                mouse.X >= 110 && mouse.X <= 830 &&
                mouse.Y >= 355 && mouse.Y <= 460 &&
                Open == true)
            {
                menuState = GameState.Mil;
            }

            if (menuState == GameState.Con)  //changes selected con
            {
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 115 && mouse.Y <= 220 &&
                    Open == true)
                {
                    Selected_Con = Selectable_Con[0];
                }
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 235 && mouse.Y <= 340 &&
                    Open == true)
                {
                    Selected_Con = Selectable_Con[1];
                }
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 355 && mouse.Y <= 460 &&
                    Open == true)
                {
                    Selected_Con = Selectable_Con[2];
                }
            }

            if (menuState == GameState.Eco)//changes selected eco
            {
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 115 && mouse.Y <= 220 &&
                    Open == true)
                {
                    Selected_Eco = Selectable_Eco[0];
                }
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 235 && mouse.Y <= 340 &&
                    Open == true)
                {
                    Selected_Eco = Selectable_Eco[1];
                }
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 355 && mouse.Y <= 460 &&
                    Open == true)
                {
                    Selected_Eco = Selectable_Eco[2];
                }
            }

            if (menuState == GameState.Mil)//changes Selected_mil
            {
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 115 && mouse.Y <= 220 &&
                    Open == true)
                {
                    Selected_Mil = Selectable_Mil[0];
                }
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 235 && mouse.Y <= 340 &&
                    Open == true)
                {
                    Selected_Mil = Selectable_Mil[1];
                }
                if (mouse.LeftButton == ButtonState.Pressed &&
                    oldMouse.LeftButton == ButtonState.Released &&
                    mouse.X >= 870 && mouse.X <= 1590 &&
                    mouse.Y >= 355 && mouse.Y <= 460 &&
                    Open == true)
                {
                    Selected_Mil = Selectable_Mil[2];
                }
            }
        }