Exemple #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            List <MobaLib.Polygon> polygons = new List <MobaLib.Polygon>();

            for (int x = 0; x < moba.Map.Bushes.Length; x++)
            {
                polygons.Add(moba.Map.Bushes[x].Bounds);
            }
            helper.DrawFilledPolys(polygons.ToArray(), cam.Transformation, Color.Green);

            polygons.Clear();
            for (int x = 0; x < moba.Map.Collisions.Length; x++)
            {
                polygons.Add(moba.Map.Collisions[x].Bounds);
            }
            helper.DrawFilledPolys(polygons.ToArray(), cam.Transformation, Color.Black);

            for (int x = 0; x < moba.Teams.Length; x++)
            {
                DrawTeamThings(moba.Teams[x], moba.Teams[1 - x]);
            }

            polygons.Clear();
            for (int x = 0; x < moba.Map.Attacks.Count; x++)
            {
                MobaLib.Vector3 position = moba.Map.Attacks[x].GetPosition();
                polygons.Add(new Polygon(new MobaLib.Vector3[] {
                    position + new MobaLib.Vector3(-1, 0, -1),
                    position + new MobaLib.Vector3(1, 0, -1),
                    position + new MobaLib.Vector3(1, 0, 1),
                    position + new MobaLib.Vector3(-1, 0, 1),
                }
                                         ));
            }

            helper.DrawFilledPolys(polygons.ToArray(), cam.Transformation, Color.White);


            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Exemple #2
0
        void DrawTeamThings(Team team, Team enemyTeam)
        {
            Color color = new Color(team.R, team.G, team.B);

            List <MobaLib.Polygon> polygons = new List <MobaLib.Polygon>();

            for (int x = 0; x < moba.Map.Characters.Count; x++)
            {
                if (moba.Map.Characters[x].GetTeam() != team || !moba.Map.Characters[x].IsTargetable(enemyTeam))
                {
                    continue;
                }
                MobaLib.Vector3 position = moba.Map.Characters[x].GetPosition();

                polygons.Add(new Polygon(new MobaLib.Vector3[] {
                    position + new MobaLib.Vector3(-1, 0, -1) * moba.Map.Characters[x].Size / 2.0f,
                    position + new MobaLib.Vector3(1, 0, -1) * moba.Map.Characters[x].Size / 2.0f,
                    position + new MobaLib.Vector3(1, 0, 1) * moba.Map.Characters[x].Size / 2.0f,
                    position + new MobaLib.Vector3(-1, 0, 1) * moba.Map.Characters[x].Size / 2.0f,
                }));
                polygons.Add(new Polygon(new MobaLib.Vector3[] {
                    position - new MobaLib.Vector3(moba.Map.Characters[x].Size / 2.0f, 0, moba.Map.Characters[x].Size / 2.0f + 2),
                    position + new MobaLib.Vector3(-1 + 2 * moba.Map.Characters[x].Health / moba.Map.Characters[x].GetInfo().maxHealth, 0, -1 - 4 / moba.Map.Characters[x].Size) * moba.Map.Characters[x].Size / 2.0f,
                    position + new MobaLib.Vector3(-1 + 2 * moba.Map.Characters[x].Health / moba.Map.Characters[x].GetInfo().maxHealth, 0, -1 - 2 / moba.Map.Characters[x].Size) * moba.Map.Characters[x].Size / 2.0f,
                    position - new MobaLib.Vector3(moba.Map.Characters[x].Size / 2.0f, 0, moba.Map.Characters[x].Size / 2.0f + 1),
                }));
            }

            for (int x = 0; x < moba.Map.Structures.Length; x++)
            {
                if (moba.Map.Structures[x].GetTeam() == team && !moba.Map.Structures[x].IsDead())
                {
                    polygons.Add(moba.Map.Structures[x].Bounds);
                }
            }

            helper.DrawFilledPolys(polygons.ToArray(), cam.Transformation, color);
        }