コード例 #1
0
ファイル: Marker.cs プロジェクト: JordanFisher/WAL
 public void Draw()
 {
     DrawTexture.Using(world.camvec, world.CameraAspect, texture);
     quad.SetColor(new color(1, 1, 1, alpha));
     quad.Draw(GameClass.Game.GraphicsDevice);
 }
コード例 #2
0
        void DrawDragonLordMarker(int player, bool After = false)
        {
            if (!TrackDragonLord)
            {
                return;
            }

            vec2 cur  = CurDragonLordPos[player];
            vec2 prev = PrevDragonLordPos[player];

            if (cur.x < 1 && cur.y < 1)
            {
                return;
            }

            var q = new RectangleQuad();
            var p = cur * PercentSimStepComplete + prev * (1 - PercentSimStepComplete);

            p = GridToWorldCood(p);
            var   s     = vec(.01f, .01f) + .0001f * vec2.Ones * (float)Math.Cos(GameClass.Game.DrawCount * .08f);
            float alpha = 1;

            bool selected = DataGroup.UnitSummary[Int(UnitType.DragonLord) - 1];

            if (!After)
            {
                alpha = selected ? .11f : .05f;
                color clr = selected ? new color(1f, 1f, 1f, alpha) : new color(.8f, .8f, .8f, alpha);

                q.SetupVertices(p - s * 3, p + s * 3, vec(0, 0), vec(1, 1));
                q.SetColor(clr);

                DrawTexture.Using(camvec, CameraAspect, Assets.DragonLord_Marker);
                q.Draw(GameClass.Game.GraphicsDevice);

                q.SetupVertices(p - s * .5f, p + s * .5f, vec(0, 0), vec(1, 1));
                q.SetColor(clr);

                DrawTexture.Using(camvec, CameraAspect, Assets.DragonLord_Marker);
                q.Draw(GameClass.Game.GraphicsDevice);
            }

            if (After)
            {
                float z = 14;
                if (CameraZoom <= z / 4f)
                {
                    s    *= 7;
                    alpha = CoreMath.LerpRestrict(z / 4, 0, z / 8, 1, CameraZoom);
                }
                else
                {
                    return;
                }

                q.SetupVertices(p - s, p + s, vec(0, 0), vec(1, 1));
                q.SetColor(new color(.8f, .8f, .8f, 1f * alpha));

                var texture = Assets.AoE_DragonLord[player];
                if (player == MyPlayerNumber && selected)
                {
                    texture = Assets.AoE_DragonLord_Selected;
                }

                DrawTexture.Using(camvec, CameraAspect, texture);
                q.Draw(GameClass.Game.GraphicsDevice);
            }
        }