コード例 #1
0
        public void DrawRadarOnScreen(float fDeltaTime, SpriteBatch DrawBatch)
        {
            //radarCenter = new Vector2(GraphicsManager.Get().Width - 100, GraphicsManager.Get().Height - 100);
            radarCenter = new Vector2(GraphicsManager.Get().Width - 150, GraphicsManager.Get().Height - 150);

            // Draw Base Radar
            //DrawBatch.Draw(radarScreen, radarCenter, null, Color.White, 0.0f, new Vector2(radarScreen.Width/2, radarScreen.Height/2), 1.0f, SpriteEffects.None, 0.0f);
            DrawBatch.Draw(radarScreen, radarCenter, null, Color.White, 0.0f, new Vector2(radarScreen.Width / 2, radarScreen.Height / 2), 1.5f, SpriteEffects.None, 0.0f);

            // Draw Radar Spinner
            float rotateSpeed = 2.50f;
            curRotation += fDeltaTime * rotateSpeed % MathHelper.TwoPi;

            //DrawBatch.Draw(radarSpinner, radarCenter, null, Color.White, curRotation, new Vector2(radarSpinner.Width/2, radarSpinner.Height/2), 1.0f, SpriteEffects.None, 0.0f);
            DrawBatch.Draw(radarSpinner, radarCenter, null, Color.White, curRotation, new Vector2(radarSpinner.Width / 2, radarSpinner.Height / 2), 1.5f, SpriteEffects.None, 0.0f);

            // Draw Radar Compass
            player = GameState.Get().Player;
            playerPos = new Vector2(player.Position.X, player.Position.Y);
            playerForward = Vector2.Normalize(new Vector2(player.Forward.X, player.Forward.Y));

            compassAngle = (float)Math.Atan(playerForward.Y / playerForward.X);
            compassAngle -= MathHelper.PiOver2; // Making North 0 Rotation
            if (playerForward.X < 0) { compassAngle += MathHelper.Pi; } // Adjustments for Quadrants 2, 3 Transition

            //DrawBatch.Draw(radarCompass, radarCenter, null, Color.White, compassAngle, new Vector2(radarSpinner.Width / 2, radarSpinner.Height / 2), 1.0f, SpriteEffects.None, 1.0f);
            DrawBatch.Draw(radarCompass, radarCenter, null, Color.White, compassAngle, new Vector2(radarSpinner.Width / 2, radarSpinner.Height / 2), 1.5f, SpriteEffects.None, 1.0f);

            // Drawing Objects
            foreach (Objects.Building building in GameState.Get().Buildings)
            {
                Vector2 originalPos = new Vector2(building.Position.X, building.Position.Y);
                DrawRadarBlip(DrawBatch, originalPos, eBlips.building);
            }

            foreach (Objects.Unit unit in GameState.Get().Units)
            {
                Vector2 originalPos = new Vector2(unit.Position.X, unit.Position.Y);
                if (unit.Team == eTeam.Jedi)
                {
                    if (unit.Flying)
                    {
                        DrawRadarBlip(DrawBatch, originalPos, eBlips.enemyFlying);
                    }
                    else
                    {
                        DrawRadarBlip(DrawBatch, originalPos, eBlips.friend);
                    }
                }
                else
                {
                    if (unit.Flying)
                    {
                        DrawRadarBlip(DrawBatch, originalPos, eBlips.enemyFlying);
                    }
                    else
                    {
                        DrawRadarBlip(DrawBatch, originalPos, eBlips.enemy);
                    }
                }
            }
        }
コード例 #2
0
ファイル: LuaAPI.cs プロジェクト: Keldyn/BattleOfTheClans
 public void SetActivity(Common.CombatMessage.Activity activity, int handle, Common.Resource activityObject, Objects.Unit performer, Objects.Unit target)
 {
     currentActivity = activity;
     currentHandle = handle;
     currentActivityObject = activityObject;
     currentPerformer = performer;
     currentTarget = target;
 }
コード例 #3
0
ファイル: Brain.cs プロジェクト: AaronCC/RealTimeStrategy
 public Brain(Objects.Unit _body)
 {
     body = _body;
 }