Ejemplo n.º 1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="owner"></param>
 public Game(Program owner)
 {
     this.owner   = owner;
     birds        = new Birds(2);
     birds.Random = true;
     //XMesh cornMesh = new XMesh("data/corn.x");
     //corn.Mesh = cornMesh;
     //corn.Position = new Microsoft.DirectX.Vector3(-20, 0, 20);
     //corn.Scale = new Microsoft.DirectX.Vector3(2f, 2f, 2f);
     //owner.TransparentObjectManager.Objects.Add(corn);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public ScareCrow()
        {
            cornMesh = new XMesh("data/corn.x");
            cornfields.Add(new CornField(cornMesh, new Vector3(30, 0, 30)));
            cornfields.Add(new CornField(cornMesh, new Vector3(-30, 0, 30)));
            cornfields.Add(new CornField(cornMesh, new Vector3(-30, 0, -30)));

            birds        = new Birds(100);
            birds.Random = false;
            birds.SetRandomTarget();

            arrow      = new GameObject();
            arrow.Mesh = new XMesh("data\\arrow.x");

            startTime = 0;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Clean up.
        /// </summary>
        public void Dispose()
        {
            Program.Instance.CenterHud.ShowGameText("", 1000);
            foreach (CornField field in cornfields)
            {
                field.Dispose();
            }
            cornfields.Clear();
            if (birds != null)
            {
                birds.Dispose();
                birds = null;
            }

            if (arrow != null)
            {
                arrow.Dispose();
                arrow = null;
            }
            cornMesh.Dispose();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This event will be fired immediately after the Direct3D device has been
        /// created, which will happen during application initialization and windowed/full screen
        /// toggles. This is the best location to create Pool.Managed resources since these
        /// resources need to be reloaded whenever the device is destroyed. Resources created
        /// here should be released in the Disposing event.
        /// </summary>
        private void OnCreateDevice(object sender, DeviceEventArgs e)
        {
            transparentObjectManager = new TransparentObjectManager();

            // Initialize the stats font
            //statsFont = ResourceCache.GetGlobalInstance().CreateFont(e.Device, 15, 0, FontWeight.Bold, 1, false, CharacterSet.Default,
            //    Precision.Default, FontQuality.Default, PitchAndFamily.FamilyDoNotCare | PitchAndFamily.DefaultPitch
            //    , "Arial");
            // Create the camera
            camera             = new FirstPersonCamera("FPCamera");
            camera.AspectRatio = (float)(e.BackBufferDescription.Width) / e.BackBufferDescription.Height;
            camera.MoveScaler  = 50.0f;

            weather = new Weather(this);

            // Create the ground
            scenery = new Scenery(this);
            scenery.LoadDefinition("data/scenery/default/default.par");
            //scenery.LoadDefinition(@"C:\Users\Gebruiker\Documents\RC Desk Pilot\Scenery\Aero Club Bad Oldesloe\Aero Club Bad Oldesloe.par");
            scenery.SetWaterCallback(this.OnFrameRenderWater);

            // Create birds
            birds        = new Birds(100);
            birds.Random = true;

            // Create the 3Dcursor
            cursor3d = new Cursor3D();

            selectedObject = new SelectedObject();
            RCSim.TerrainDefinition.ObjectTypeEnum objectType;
            selectedObject.SetSelectedObject(scenery.Definition.GetNearestObject(cursor3d.Position, out objectType));

            sun       = new DirectionalLight(new Vector3(0.5f, -0.707f, 0.5f));
            sun.Color = System.Drawing.Color.FromArgb(148, 148, 148);

            framework.CurrentCamera = camera;
        }