WorldTransform() public static method

given a List of 2D vectors, a position and orientation this function transforms the 2D vectors into the object's world space
public static WorldTransform ( List points, Vector2D pos, Vector2D forward, Vector2D side ) : List
points List
pos Vector2D
forward Vector2D
side Vector2D
return List
コード例 #1
0
        //--------------------------- Render -------------------------------------
        //
        //------------------------------------------------------------------------
        public override void Render(Graphics g)
        {
            List <Vector2D> transformed = Transformations.WorldTransform(_vecPlayerVB,
                                                                         Position,
                                                                         _lookAt,
                                                                         _lookAt.Perp,
                                                                         Scale);


            GDI.CurrentPen = Team.Color == SoccerTeam.SoccerTeamColor.Blue ? bluePen : redPen;
            GDI.DrawPolygon(g, transformed);

            //draw the head
            GDI.CurrentBrush = new SolidBrush(Color.FromArgb(133, 90, 0));
            GDI.DrawCircle(g, Position, 6.0f);

            //draw the ID
            if (ParameterManager.Instance.ShowIDs)
            {
                g.DrawString(ObjectId.ToString(), GDI.TextFont, textBrush, new PointF((float)Position.X - 20.0f, (float)Position.Y - GDI.TextFont.Height));
            }

            //draw the state
            if (ParameterManager.Instance.ShowStates)
            {
                Brush textBrush = new SolidBrush(Color.FromArgb(0, 170, 0));
                g.DrawString(_stateMachine.CurrentState.ToString(), GDI.TextFont, textBrush, new PointF((float)Position.X, (float)Position.Y - GDI.TextFont.Height));
            }
        }
コード例 #2
0
        //--------------------------- Render -------------------------------------
        //
        //------------------------------------------------------------------------
        public override void Render(Graphics g)
        {
            //set appropriate team color
            GDI.CurrentPen = (Team.Color == SoccerTeam.SoccerTeamColor.Blue) ? Pens.Blue : Pens.Red;

            // draw the body, translated to it's local coordinate space
            List <Vector2D> vectors = Transformations.WorldTransform(_vecPlayerVB, Position, Heading, Side, Scale);

            GDI.DrawPolygon(g, vectors);

            // draw his head
            GDI.CurrentBrush = new SolidBrush(Color.FromArgb(133, 90, 0));
            if (ParameterManager.Instance.ShowHighlightIfThreatened && (Team.ControllingPlayer == this) && IsThreatened())
            {
                GDI.CurrentBrush = Brushes.Yellow;
            }
            GDI.DrawCircle(g, Position, 6.0f);

            //render the state
            if (ParameterManager.Instance.ShowStates)
            {
                Brush stateBrush = new SolidBrush(Color.FromArgb(0, 170, 0));
                g.DrawString(_stateMachine.CurrentState.ToString(), GDI.TextFont, stateBrush, new PointF((float)Position.X, (float)Position.Y - GDI.TextFont.Height));
            }

            //show IDs
            if (ParameterManager.Instance.ShowIDs)
            {
                g.DrawString(ObjectId.ToString(), GDI.TextFont, textBrush, new PointF((float)Position.X - 20.0f, (float)Position.Y - GDI.TextFont.Height));
            }

            if (ParameterManager.Instance.ShowViewTargets)
            {
                g.FillEllipse(textBrush, new RectangleF((float)SteeringBehaviors.Target.X, (float)SteeringBehaviors.Target.Y, 3.0f, 3.0f));
                g.DrawString(ObjectId.ToString(), GDI.TextFont, Brushes.Red, new PointF((float)SteeringBehaviors.Target.X, (float)SteeringBehaviors.Target.Y));
            }
        }