Exemple #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
        public BoardVisuals(Game1 game)
        {
            sship = game.Content.Load<Model>("smallship");
            mship = game.Content.Load<Model>("mediumship");
            lship = game.Content.Load<Model>("longship");
            carrier = game.Content.Load<Model>("cruiser");
            sub = game.Content.Load<Model>("submarine");
            comp1 = game.Content.Load<Model>("comp1");
            comp2 = game.Content.Load<Model>("comp2");
            square = game.Content.Load<Model>("square");
            sphere = game.Content.Load<Model>("sphere");

            fader = game.Content.Load<Texture2D>("black");

            Random rand = new Random();

            TbasicEffect = new BasicEffect(game.GraphicsDevice);
            TbasicEffect.VertexColorEnabled = true;

            float xs = -0.55f, dx = 0.14f, zs = -1.8f, dz = -0.105f, y = -0.55f;

            for (int i = 0; i < NUM_WATER; i++)
            {
                for (int j = 0; j < NUM_WATER; j++)
                {
                    float ry = (float)rand.NextDouble() * 0.05f;
                    float tx = (i / (float)NUM_WATER) * 12f - 2f;
                    float ty = (j / (float)NUM_WATER) * 12f - 2f;
                    water.Add(new WaterVertex(new Vector3(xs + dx * tx, y + ry, zs + dz * ty), rand.Next(2) == 0));
                }
            }

            load(game);
        }