Esempio n. 1
0
 public override void Draw(Camera c)
 {
     bool tmp = base.selected;
     base.Draw(c);
     currentPos.Y += 1;
     base.selected = tmp;
     base.Draw(c);
     currentPos.Y -= 1;
 }
Esempio n. 2
0
        public Menu(Font3D f, Color c1, Color c2)
        {
            cam = new Camera(new Vector3(0, MathHelper.Pi, 0), 240, Vector3.Zero, Vector3.Up);

            font = f;
            color1 = c1;
            color2 = c2;
            items = new LinkedList<MenuItem>();
            positive = true;
        }
Esempio n. 3
0
 public virtual void Draw(Camera c)
 {
     Vector3 clr;
     if (selected)
     {
         clr = new Vector3(1, 0, 0);
         selected = false;
     }
     else
         clr = color;
     ((BasicEffect)model.Meshes[0].Effects[0]).DiffuseColor = clr;
     ((BasicEffect)model.Meshes[0].Effects[0]).Alpha = alpha;
     c.render(model, Matrix.CreateTranslation(currentPos), aTrans);
 }
Esempio n. 4
0
        public Player(PlayerSettings p, int i)
        {
            if (p.name == null)
                name = "Player " + (i + 1);
            else
                name = p.name;

            nameTag = new Text3D(name, Font3D.getFont("arial"), null);

            if (p.avatar == null)
                avatar = Texture2D.FromStream(Program.game.GraphicsDevice, System.IO.File.OpenRead("default.png"));
            else
                avatar = p.avatar;

            cam = new Camera(new Vector3(0.7f, i == 1 ? 0 : MathHelper.Pi, 0), 80, Vector3.Zero, Vector3.Up);
            selection = new Vector(0, i == 1 ? 0 : 7);
            index = i;
        }
Esempio n. 5
0
        public void DrawLabel(Camera c)
        {
            nameTag.cam = c;

            ((BasicEffect)label.Meshes[1].Effects[0]).Texture = avatar;
            ((BasicEffect)label.Meshes[2].Effects[0]).Texture = avatar;
            c.render(label, Matrix.CreateTranslation(0, -5, 0)
                * Matrix.CreateRotationX(-c.Rotation.Y / 2 + MathHelper.PiOver4)
                * Matrix.CreateTranslation(0, 5, index == 0 ? 30 : -30), labelTrans);

            nameTag.Draw(Matrix.CreateTranslation(0, -5, 0)
                * Matrix.CreateScale(0.2f)
                * Matrix.CreateRotationY(index == 0 ? 0 : MathHelper.Pi)
                * Matrix.CreateRotationX(-c.Rotation.Y / 2 + MathHelper.PiOver4)
                * Matrix.CreateTranslation(index == 0 ? -8 : 8, 5, index == 0 ? 31 : -31), Color.Green);
            nameTag.Draw(Matrix.CreateTranslation(0, -5, 0)
                * Matrix.CreateScale(0.2f)
                * Matrix.CreateRotationY(index == 1 ? 0 : MathHelper.Pi)
                * Matrix.CreateRotationX(-c.Rotation.Y / 2 + MathHelper.PiOver4)
                * Matrix.CreateTranslation(index == 1 ? -8 : 8, 5, index == 0 ? 29 : -29), Color.Green);
        }
Esempio n. 6
0
 public void Draw(Camera c)
 {
     if (p != null)
         p.Draw(c);
 }
Esempio n. 7
0
        public void Draw(Camera c)
        {
            ((BasicEffect)model.Meshes[0].Effects[0]).DirectionalLight0.Direction =
                Vector3.Negate(Vector3.Normalize(c.position));

            c.render(model, Matrix.Identity, aTrans);
            for (int i = 0; i < 8; i++)
                for (int j = 0; j < 8; j++)
                    tiles[i][j].Draw(c);
        }
Esempio n. 8
0
 public Camera clone()
 {
     Camera r = new Camera();
     r.goTo = goTo;
     r.position = new Vector3(position.X,position.Y,position.Z);
     r.projection = projection;
     r.rot2 = new Vector2(rot2.X, rot2.Y);
     r.rotation = new Vector3(rotation.X, rotation.Y, rotation.Z);
     r.target = new Vector3(target.X, target.Y, target.Z);
     r.up = new Vector3(up.X, up.Y, up.Z);
     r.view = view;
     r.zoom = zoom;
     return r;
 }
Esempio n. 9
0
 public void updateGoTo(float speed)
 {
     if (goTo != null)
     {
         if (rotation == Vector3.Zero && goToTarget(goTo.target, speed)
             && goToPosition(goTo.position, speed)
             || rotation != Vector3.Zero && goToTarget(goTo.target, speed)
             && goToRotation(goTo.rotation, goTo.zoom, speed))
             goTo = null;
     }
 }