示例#1
0
        //internal bool AbovePoint;

        public GroupInfoBox(Vector2 pos, SpawnGroup spg, bool aboveSpawnPoint)
            : base(pos)
        {
            Group       = spg;
            SmallBugTex = spg.InfoTexture;
            TexOrigin   = spg.infoTexOrigin;
            //AbovePoint = aboveSpawnPoint;
            //TexOrigin.X += 0.5f;
            Bounds = new Rectangle((int)pos.X, (int)pos.Y, boxWidth, boxHeight);            //(int)(CurrentGame.font.LineSpacing * textScale) + boxWidth);
            //TextPos = new Vector2(Bounds.X + Padding, Bounds.Y + YPadding);
            if (aboveSpawnPoint)
            {
                PosY  -= 2;
                BugBox = new BugInfoBox(new Vector2(Bounds.Center.X - DefaultWidth * 0.5f, Bounds.Top - DefaultHeight), Group.ExampleCreature, false, aboveSpawnPoint, this);
            }
            else
            {
                PosY  += 1;
                BugBox = new BugInfoBox(new Vector2(Bounds.Center.X - DefaultWidth * 0.5f, Bounds.Bottom), Group.ExampleCreature, false, aboveSpawnPoint, this);
            }
        }
示例#2
0
文件: HexMap.cs 项目: jamikka/AlkuTD
        public void Update()
        {
            //if (Players[0].Towers.Count > 0) Players[0].Towers[Players[0].Towers.Count - 1].Range = Math.Max(mouse.ScrollWheelValue / 200, 100); //-----------------SCROLLRANGE-----------------

            if (AliveCreatures.Count == 0)             //&& Waves[Waves.GetUpperBound(0)].Groups[0].spawnTimer >= Waves[Waves.GetUpperBound(0)].Duration + 100) // if no alive creatures and last wave's first group's spawntimer is beyond last wave's duration + arbitrary some
            {
                Wave       lastWave  = Waves[Waves.GetUpperBound(0)];
                SpawnGroup lastGroup = lastWave.Groups[lastWave.Groups.GetUpperBound(0)];
                if (lastGroup.IsWholeGroupBorn)
                {
                    CurrentGame.gameState = GameState.GameOver;
                }

                /*if (CurrentGame.gameState == GameState.InGame)
                 * {
                 *  ParentGame.mainMenu.SavePlayerData(); //------------neeeds planning
                 *  ParentGame.gameState = Game1.GameState.LevelComplete;  //----------------------TODO: LEVEL COMPLETION STATE-------------------------------!!
                 * }*/
                //else
                // CurrentGame.gameState = GameState.GameOver;
            }
            if (!initSetupOn)
            {
                /*for (int o = 1; o < GoalPointTimetable.Length; o++)
                 * {
                 *  if (mapTimer == GoalPointTimetable[o]) //----------------------------------------------------------------------------------------HUOM maptimer ei huomioi wave-aikaistuksia
                 *  {
                 *      foreach (Creature c in AliveCreatures)
                 *      {
                 *          //if (c.GoalPointIndex.Length > 1)
                 *              c.FindPath();
                 *      }
                 *      creatureCue = ParentGame.soundBank.GetCue("plurputus1");
                 *      creatureCue.Play();
                 *  }
                 * }*/

                //---------------------------------------------------------------eikös tänkin vois laittaa on-demand, öröjen vastuulle
                bool PKeyDown = CurrentGame.keyboard.IsKeyDown(Keys.P);
                for (int w = 0; w < Waves.Length; w++)
                {
                    for (int g = 0; g < Waves[w].Groups.Length; g++)
                    {
                        for (int c = 0; c < Waves[w].Groups[g].Creatures.Length; c++)
                        {
                            Waves[w].Groups[g].Creatures[c].ShowingPath = PKeyDown;
                        }
                    }
                    if (w <= currentWave)
                    {
                        Waves[w].Update();
                    }
                }
                if (Waves[currentWave].Groups[0].spawnTimer == Waves[currentWave].Duration - 1 && currentWave != Waves.GetUpperBound(0)) //------------------------------------------hmmmm
                {
                    currentWave++;
                    HUD.UpdateWaveInfo();
                }
                mapTimer++;
            }
            else             //initSetupOn
            {
                for (int w = 0; w < Waves.Length; w++)
                {
                    for (int g = 0; g < Waves[w].Groups.Length; g++)
                    {
                        for (int c = 0; c < Waves[w].Groups[g].Creatures.Length; c++)
                        {
                            Waves[w].Groups[g].Creatures[c].ShowingPath = true;
                        }
                    }
                }
            }

            for (int i = 0; i < Players[0].Towers.Count; i++)
            {
                Players[0].Towers[i].Update(AliveCreatures);
            }
        }