Exemple #1
0
        Vector3 searchloc; //Location that an enemy will approach to search for a player

        #endregion Fields

        #region Constructors

        public Enemy(LabGame game, EnemyController controller, EnemyType etype, Vector3 pos)
            : base()
        {
            this.game = game;
            type = GameObjectType.Enemy;
            myModel = game.assets.GetModel("player", CreateEnemyModel);
            this.pos = pos;
            this.maxspeed = 0.15f;
            this.range = 4;
            this.detected = false;
            this.controller = controller;
            this.detectrange = 3.5f;
            this.escaperange = detectrange * 2;
            this.etype = etype;
            searchloc = controller.newSearch(this, pos);
            this.locallight.lightCol = new Vector4(0.15f, 0f, 0f, 1f);
            this.locallight.lightPos = new Vector4(this.pos.X, this.pos.Y, this.pos.Z - 2, 1f);
            GetParamsFromModel();
            fireTimer = 0;
            fireDistance = 4;
        }
Exemple #2
0
        /// <summary>
        /// Load game content.
        /// </summary>
        protected override void LoadContent()
        {
            // Initialise game object containers.
            gameObjects = new List<GameObject>();
            addedGameObjects = new Stack<GameObject>();
            removedGameObjects = new Stack<GameObject>();

            // Create game objects.
            worldBase = new Land(this, this.size);
            gameObjects.Add(worldBase);
            ocean = new Ocean(this, this.size);
            gameObjects.Add(ocean);
            lighting = new LightingController(this);
            gameObjects.Add(lighting);
            player = new Player(this);
            gameObjects.Add(player);
            controller = new EnemyController(this);
            gameObjects.Add(controller);

            base.LoadContent();
        }
        protected override void LoadContent()
        {
            // Create the camera
            camera = new Camera(this);
            sun = new Sun(this);
            landscape = new Landscape(this); // must init first.
            landscape.shader_option = 0;
            player = new Player(this);
            enemyController = new EnemyController(this);
            allBalls.Add(player);
            foreach(Enemy e in enemyController.enemies){ allBalls.Add(e); }

            camera.position = player.pos;
            this.score = 0;
            this.music = 100;
            this.target_score = 30;
            // Create an input layout from the vertices
            base.LoadContent();
        }