Exemple #1
0
        public new void Draw()
        {
            if (player == Player.Computer)
            {
                Sprite.BasicEffect.View = boardTranslation * Camara.View;
            }

            Sprite.BasicEffect.TextureEnabled  = true;
            Sprite.BasicEffect.Texture         = EngineContent.GetTextureByName("boardCell");
            Sprite.BasicEffect.LightingEnabled = false;

            foreach (EffectPass pass in Sprite.BasicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                //PORT
                //Sprite.Graphics.GraphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Anisotropic;
                //Sprite.Graphics.GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Anisotropic;
                //Sprite.Graphics.GraphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Linear;
                //Sprite.Graphics.GraphicsDevice.SamplerStates[0].MaxAnisotropy = 16;
                //Sprite.BasicEffect.CommitChanges();


                Sprite.Graphics.GraphicsDevice.DrawUserPrimitives <VertexPositionTexture>(
                    PrimitiveType.TriangleList,
                    pointList,
                    0,  // vertex buffer offset to add to each element of the index buffer
                    300 // number of vertices in pointList
                    );
            }
            Sprite.BasicEffect.LightingEnabled = true;
            Sprite.BasicEffect.View            = Camara.View;
        }
Exemple #2
0
        public new void Create()
        {
            texture = EngineContent.GetTextureByName("boardCell");

            pointList = new VertexPositionTexture[900]; // 150 celdas * 6 puntos cada una

            int index = 0;

            for (int x = 0; x < 10; x++)
            {
                for (int y = 0; y < 15; y++)
                {
                    pointList[index] = new VertexPositionTexture(
                        new Vector3(x, Game.BoardAltitude, y), new Vector2(0, 0));

                    pointList[index + 1] = new VertexPositionTexture(
                        new Vector3(x + 1, Game.BoardAltitude, y), new Vector2(1, 0));

                    pointList[index + 2] = new VertexPositionTexture(
                        new Vector3(x, Game.BoardAltitude, y + 1), new Vector2(0, 1));

                    pointList[index + 3] = new VertexPositionTexture(
                        new Vector3(x, Game.BoardAltitude, y + 1), new Vector2(0, 1));

                    pointList[index + 4] = new VertexPositionTexture(
                        new Vector3(x + 1, Game.BoardAltitude, y), new Vector2(1, 0));

                    pointList[index + 5] = new VertexPositionTexture(
                        new Vector3(x + 1, Game.BoardAltitude, y + 1), new Vector2(1, 1));

                    index += 6;
                }
            }
        }
Exemple #3
0
 public Fire(float px, float py, float pz, Player player)
 {
     base.scale = 1;
     alpha      = 0;
     alpha     += (float)(randomizer.NextDouble() * 0.1);
     direction  = Game.Alternator();
     if (direction == 1)
     {
         transHorz = -0.09f;
     }
     else
     {
         transHorz = 0.09f;
     }
     x              = px + 0.5f;
     y              = pz + 0.5f + (float)(randomizer.NextDouble() * 0.1) * direction;
     angleRot       = 55 * (float)randomizer.NextDouble();
     this.textureID = EngineContent.GetTextureByName("fire");
     if (player == Player.Computer)
     {
         x += Game.BoardSeparation;
     }
     position  = new Vector3(x, 0, y);;
     translate = new Vector3(transHorz, transVert, 0);
 }
Exemple #4
0
 public void Create()
 {
     textHover  = EngineContent.GetTextureByName(textHoverS);
     texPressed = EngineContent.GetTextureByName(texPressedS);
     texNormal  = EngineContent.GetTextureByName(texNormalS);
     texCurrent = texNormal;
 }
        public new void Draw()
        {
            Sprite.BasicEffect.TextureEnabled  = true;
            Sprite.BasicEffect.Texture         = EngineContent.GetTextureByName("boardCell");
            Sprite.BasicEffect.LightingEnabled = false;

            Sprite.BasicEffect.Begin();

            //Sprite.Graphics.GraphicsDevice.RenderState.FillMode = FillMode.WireFrame;
            //Sprite.Graphics.GraphicsDevice.RenderState.CullMode = CullMode.None;

            foreach (EffectPass pass in Sprite.BasicEffect.CurrentTechnique.Passes)
            {
                pass.Begin();

                Sprite.Graphics.GraphicsDevice.VertexDeclaration = new VertexDeclaration(Sprite.Graphics.GraphicsDevice,
                                                                                         VertexPositionTexture.VertexElements);

                Sprite.Graphics.GraphicsDevice.DrawUserPrimitives <VertexPositionTexture>(
                    PrimitiveType.TriangleList,
                    pointList,
                    0,  // vertex buffer offset to add to each element of the index buffer
                    300 // number of vertices in pointList
                    );

                pass.End();
            }

            Sprite.Graphics.GraphicsDevice.RenderState.FillMode = FillMode.Solid;

            Sprite.BasicEffect.End();
        }
Exemple #6
0
 public Cloud()
 {
     angle          = ((float)randomizer.NextDouble() * 30 + 10) * direction;
     position       = new Vector3(10, 15, -35);
     base.textureID = EngineContent.GetTextureByName("cloud");
     scaleModel     = new Vector3(15, 8, 1);
 }
        public new void Create()
        {
            if (player == Player.Computer)
            {
                translate = Matrix.CreateTranslation(Game.BoardSeparation, 0, 0);
            }
            else
            {
                translate = Matrix.Identity;
            }

            textureID = EngineContent.GetTextureByName(textureName);

            pointList = new VertexPositionTexture[6];

            pointList[0] = new VertexPositionTexture(
                new Vector3(0, Game.BoardAltitude, 0), new Vector2(0, 0));

            pointList[1] = new VertexPositionTexture(
                new Vector3(1, Game.BoardAltitude, 0), new Vector2(1, 0));

            pointList[2] = new VertexPositionTexture(
                new Vector3(0, Game.BoardAltitude, 1), new Vector2(0, 1));

            pointList[3] = new VertexPositionTexture(
                new Vector3(0, Game.BoardAltitude, 1), new Vector2(0, 1));

            pointList[4] = new VertexPositionTexture(
                new Vector3(1, Game.BoardAltitude, 0), new Vector2(1, 0));

            pointList[5] = new VertexPositionTexture(
                new Vector3(1, Game.BoardAltitude, 1), new Vector2(1, 1));
        }
 public virtual void Draw()
 {
     foreach (ModelMesh mesh in modelMeshes.Meshes)
     {
         // This is where the mesh orientation is set, as well as our camera and projection.
         foreach (BasicEffect effect in mesh.Effects)
         {
             effect.EnableDefaultLighting();
             effect.World      = mesh.ParentBone.Transform * Matrix.CreateFromYawPitchRoll(0, -MathHelper.PiOver2, 0);
             effect.View       = Camara.View;
             effect.Projection = Camara.Projection;
             if (EngineContent.GetTextureByName(mesh.Name) != null)
             {
                 effect.TextureEnabled = true;
                 effect.Texture        = EngineContent.GetTextureByName(mesh.Name);
             }
             else
             {
                 effect.TextureEnabled = false;
             }
         }
         // Draw the mesh, using the effects set above.
         mesh.Draw();
     }
 }
 public new void Create()
 {
     texturePlayer = EngineContent.GetTextureByName("logoPlayer");
     textureCPU    = EngineContent.GetTextureByName("logoCPU");
     textureID     = texturePlayer;
     base.file     = "sphere";
     base.Create();
 }
Exemple #10
0
        public Ship()
        {
            this.IsTarget = true;

            //randomizo la direccion de rotacion
            angleDirX      = Game.Alternator();
            angleDirZ      = Game.Alternator();
            textureBurn    = EngineContent.GetTextureByName("barcoquemao");
            currentTexture = textureID;
        }
Exemple #11
0
 public Panel(Rectangle rectangle, string texture, Aligment aligment)
 {
     base.zOrder        = 1;
     base.areaRectangle = rectangle;
     if (aligment == Aligment.Center)
     {
         areaRectangle.X = Globals.ScreenWidthOver2 - areaRectangle.Width / 2;
     }
     this.texture = EngineContent.GetTextureByName(texture);
 }
Exemple #12
0
        public new void Create()
        {
            VertexPositionTexture[] waterVertices = CreateWaterVertices();
            int[] waterIndices = CreateWaterIndices();
            CreateBuffers(waterVertices, waterIndices);

            waterBumps    = EngineContent.GetTextureByName("waterbumps");
            effect        = EngineContent.GetEffectByName("oceanwater");
            skyboxTexture = EngineContent.GetTextureCubeByName("skybox02");
        }
Exemple #13
0
        public ShipSmoke(Vector3 pCoord)
        {
            alpha         -= (float)randomizer.NextDouble() * 0.1f;
            this.position  = pCoord;
            base.scale     = (float)randomizer.NextDouble();
            base.textureID = EngineContent.GetTextureByName("shipSmoke");

            if (scale > 0.5f)
            {
                angleRot += 90;
            }
        }
Exemple #14
0
        public FlagButton(Rectangle rectangle, MouseClick onClick, Vector3 flagPos, string text, string textureFlag)
        {
            base.areaRectangle = rectangle;
            base.mouseClick    = onClick;
            this.text          = text;
            Texture2D textureID = EngineContent.GetTextureByName(textureFlag);

            flag         = new Flag(flagPos, new Vector3(1.1f, 1.7f, 2), textureID, rectangle);
            textSize     = Sprite.SpriteFont.MeasureString(text);
            textPosition = new Vector2(areaRectangle.X + (areaRectangle.Width - textSize.X) / 2,
                                       areaRectangle.Y + areaRectangle.Height);
            base.fontColor = Color.WhiteSmoke;
        }
 public ExplosionWave(int x, int y, Player player, int type)
 {
     base.file   = "sphere";
     this.x      = x;
     this.y      = y;
     this.player = player;
     if (type == 0)
     {
         base.textureID = EngineContent.GetTextureByName("imagenMar");;
     }
     else
     {
         base.textureID = EngineContent.GetTextureByName("explosion");
     }
 }
 public MisileFire(Vector3 pCoord)
 {
     coord          = pCoord;
     base.textureID = EngineContent.GetTextureByName("fireMisile");
     base.scale     = 0.7f;
 }
Exemple #17
0
 public new void Create()
 {
     textureID = EngineContent.GetTextureByName("sun");
     sunGlow   = EngineContent.GetTextureByName("sunGlow");
 }
Exemple #18
0
 public void AddText(string text, int time, SpriteFont font, Color textColor, int half)
 {
     screens[(int)selectedScreen].AddControl(new Message(text, time, font, textColor, half, EngineContent.GetTextureByName("message")));
 }
Exemple #19
0
 public new void Create()
 {
     this.textureID = EngineContent.GetTextureByName("misil");
     base.Create();
 }
        public MainScreen(Manager manager)
        {
            base.manager = manager;

            if (Layout.ScreenFormat == ScreenFormat.Format4X3)
            {
                flag = new Flag(new Vector3(1, 1, 0.01f), new Vector3(1.2f, 2, 1), EngineContent.GetTextureByName(Game.GameStrings.GetString("Title")), new Rectangle(430, 85, 520, 140));

                flag.Create();

                Edit edit = new Edit(new Rectangle(690, 660, 120, 40), "edtName", Game.GameStrings.GetString("DefaultName"));

                Panel panel = new Panel(new Rectangle(0, 0, 1024, 768), "portada", Aligment.Left);

                Button button = new Button(new Rectangle(830, 660, 100, 40), Game.GameStrings.GetString("Enter"), new MouseClick(base.EnterSetupScreen));

                Label textInsertar = new Label(Game.GameStrings.GetString("InsertName"), new Vector2(730, 622), Sprite.SpriteFont);

                FlagButton languageSpanish = new FlagButton(new Rectangle(80, 642, 100, 50), SelectSpanish, new Vector3(-5.55f, -5.1f, -15), Game.GameStrings.GetString("Spanish"), "espanna");

                FlagButton languageEnglish = new FlagButton(new Rectangle(200, 642, 100, 50), SelectEnglish, new Vector3(-3.6f, -5.1f, -15), Game.GameStrings.GetString("English"), "uk");

                Label textLanguage = new Label(Game.GameStrings.GetString("SelectLanguage"), new Rectangle(82, 622, 218, 20), Sprite.SpriteFont, Aligment.Center);

                base.AddControl(panel);
                base.AddControl(textInsertar);
                base.AddControl(button);
                base.AddControl(edit);
                base.AddControl(languageSpanish);
                base.AddControl(languageEnglish);
                base.AddControl(textLanguage);
            }
            else
            {
                flag = new Flag(new Vector3(1, 1, 0.01f), new Vector3(1.2f, 2, 1), EngineContent.GetTextureByName(Game.GameStrings.GetString("Title")), Layout.CalculateTotalLayout(new Rectangle(538, 79, 520, 140)));

                flag.Create();

                Edit edit = new Edit(Layout.CalculateTotalLayout(new Rectangle(940, 612, 120, 40)), "edtName", Game.GameStrings.GetString("DefaultName"));

                Panel panel = new Panel(Layout.CalculateTotalLayout(new Rectangle(0, 0, 1280, 720)), "portada", Aligment.Left);

                Button button = new Button(Layout.CalculateTotalLayout(new Rectangle(1080, 612, 100, 40)), Game.GameStrings.GetString("Enter"), new MouseClick(base.EnterSetupScreen));

                Label textInsertar = new Label(Game.GameStrings.GetString("InsertName"), Layout.CalculateLayoutXY(980, 574), Sprite.SpriteFont);

                FlagButton languageSpanish = new FlagButton(Layout.CalculateTotalLayout(new Rectangle(80, 596, 100, 50)), SelectSpanish, new Vector3(-5.55f, -5.1f, -15), Game.GameStrings.GetString("Spanish"), "espanna");

                FlagButton languageEnglish = new FlagButton(Layout.CalculateTotalLayout(new Rectangle(200, 596, 100, 50)), SelectEnglish, new Vector3(-3.6f, -5.1f, -15), Game.GameStrings.GetString("English"), "uk");

                Label textLanguage = new Label(Game.GameStrings.GetString("SelectLanguage"), Layout.CalculateTotalLayout(new Rectangle(82, 574, 218, 20)), Sprite.SpriteFont, Aligment.Center);

                base.AddControl(panel);
                base.AddControl(textInsertar);
                base.AddControl(button);
                base.AddControl(edit);
                base.AddControl(languageSpanish);
                base.AddControl(languageEnglish);
                base.AddControl(textLanguage);
            }
        }
 public MisileSmoke(Vector3 pCoord)
 {
     position       = pCoord;
     base.scale     = 0.5f;
     base.textureID = EngineContent.GetTextureByName("smoke");
 }
Exemple #22
0
 public void AddCursor(ECursor cname, string cursorName)
 {
     cursors.Add(cname, EngineContent.GetTextureByName(cursorName));
 }