예제 #1
0
        /// <summary>
        /// 
        /// Create an Agent.
        /// All Agents are collidable and have a single instance Object3D named agentObject.
        /// Set StepSize, create first, follow and above cameras.
        /// Set first as agentCamera
        /// 
        /// </summary>
        public Agent(Stage stage, string label, Vector3 position, Vector3 orientAxis, float radians, string meshFile)
            : base(stage, label, meshFile)
        {
            AddObject(position, orientAxis, radians);
            agentObject = instance.First<Object3D>();

            // create 3 cameras
            first = new Camera(stage, agentObject, Camera.CameraEnum.FirstCamera);
            follow = new Camera(stage, agentObject, Camera.CameraEnum.FollowCamera);
            above = new Camera(stage, agentObject, Camera.CameraEnum.AboveCamera);

            // add 3 cameras to Stage
            stage.AddCamera(first);
            stage.AddCamera(follow);
            stage.AddCamera(above);

            // initialize the first camera
            agentCamera = first;
            taggedTreasures = 0;
        }
예제 #2
0
        /// <summary>
        /// Changing camera view for Agents will always set YonFlag false
        /// and provide a clipped view.
        /// </summary>
        public void NextCamera()
        {
            cameraIndex = (cameraIndex + 1) % camera.Count;
            currentCamera = camera[cameraIndex];

            // set the appropriate projection matrix
            YonFlag = false;
            SetProjection(farYon);

            if (cameraIndex == 1 || cameraIndex == 2 || cameraIndex == 3) {
                if (flockIndex == 0)
                    gameMode = GameMode.AGENT_FLOCKING_0;
                else if (flockIndex == 1)
                    gameMode = GameMode.AGENT_FLOCKING_33;
                else if (flockIndex == 2)
                    gameMode = GameMode.AGENT_FLOCKING_67;
            }
            else if (cameraIndex == 4 || cameraIndex == 5 || cameraIndex == 6) {
                gameMode = npAgent.NPAgentGameMode;
            }
            else {
                gameMode = GameMode.MAP_TOP_DOWN;
            }
        }
예제 #3
0
        /// <summary>
        /// Set GraphicDevice display and rendering BasicEffect effect.  
        /// Create SpriteBatch, font, and font positions.
        /// Creates the traceViewport to display information and the sceneViewport
        /// to render the environment.
        /// Create and add all DrawableGameComponents and Cameras.
        /// </summary>
        protected override void LoadContent()
        {
            // initialize graphic components
            display = graphics.GraphicsDevice;
            effect = new BasicEffect(display);

            SetUpInspector();
            SetUpBlending();

            // create and add stage components
            // You must have a TopDownCamera, BoundingSphere3D, Terrain, and Agent in your stage!
            // Place objects at a position, provide rotation axis and rotation radians.
            // All location vectors are specified relative to the center of the stage.
            // Create a top-down "Whole stage" camera view, make it first camera in collection.
            topDownCamera = new Camera(this, Camera.CameraEnum.TopDownCamera);
            camera.Add(topDownCamera);

            // load bounding sphere and way point models
            boundingSphere3D = Content.Load<Model>("boundingSphereV3");
            wayPoint3D = Content.Load<Model>("100x50x100Marker");

            // create required entities
            collidable = new List<Object3D>();
            terrain = new Terrain(this, "terrain", "heightTexture", "colorTexture");
            Components.Add(terrain);

            // add players and treasures
            CreatePlayerAndNpAgent();
            CreateTreasures();
            CreatePackOfDogs();

            fontPos = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2 + 100);
            winnerFontPos = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2 - 200);
        }
예제 #4
0
 public void AddCamera(Camera aCamera)
 {
     camera.Add(aCamera);
     cameraIndex++;
 }