Exemple #1
0
        public Camera(Vector3 pos, Matrix proj)
        {
            Projection = proj;
            View = Matrix.CreateLookAt(pos, pos + new Vector3(0, 0, -1), Vector3.Up);

            this.pos = pos;
            this.vel = Vector3.Zero;

            tilt = Vector2.Zero;

            maxVel = 100f;
            dampingFactor = 0.85f;
            accFactor = 25f;
            zoomSpeed = 10f;
            tiltAmount = 3f;
            tiltLocked = false;
            lastState = new GamePadState();
            target = null;
        }
Exemple #2
0
 public void SetTarget(GameObject g)
 {
     target = g;
 }
Exemple #3
0
 public int GetGridYOf(GameObject g)
 {
     return (int)g.GetBounds().Center.Y;
 }
Exemple #4
0
        public void RegisterGridObject(GameObject g)
        {
            Circle c = g.GetBounds();
            int xMin = (int)(c.Center.X - c.Radius);
            int xMax = (int)(c.Center.X + c.Radius);
            int yMin = (int)(c.Center.Y - c.Radius);
            int yMax = (int)(c.Center.Y + c.Radius);

            xMin = (int)Math.Max(xMin, 0f);
            yMin = (int)Math.Max(yMin, 0f);
            xMax = (int)Math.Min(xMax, width-1);
            yMax = (int)Math.Min(yMax, height-1);

            for (int i = xMin; i <= xMax; i++)
            {
                for (int j = yMin; j <= yMax; j++)
                {
                    objectMap[i, j].Add(g);
                }
            }
        }
Exemple #5
0
 public void AddRadioObject(GameObject g)
 {
     radioObjects.Add(g);
 }
Exemple #6
0
 public void AddVisibleObject(GameObject g)
 {
     visibleObjects.Add(g);
 }