/// <summary> /// Constructor of the <c>Enemy</c> class. /// </summary> /// <param name="scene">Reference to the scene where the enemy moves.</param> /// <param name="modelName">File that contains the model that represents the enemy.</param> /// <param name="position">Initial position of the enemy.</param> /// <param name="rotation">Initial rotation of the enemy.</param> /// <param name="scale">Initial scale of the enemy.</param> /// <param name="maxSpeed">Max speed of the enemy.</param> /// <param name="maxLife">Max life of the enemy.</param> /// <param name="attack">Attack of the enemy.</param> public Enemy(SceneRenderer scene, string modelName, Vector3 position, Vector3 rotation, Vector3 scale, Vector2 maxSpeed, int maxLife, int attack) : base(scene, new AnimatedModel((GameModel)ModelManager.GetModel(modelName), position, rotation, scale, 0), maxSpeed, maxLife, maxLife, attack) { _lastEnemyState = State.Waiting; _enemyState = State.Waiting; _lastPlayerXDirection = XDirection.Right; _playerXDirection = XDirection.Right; ((AnimatedModel)this.DModel).TimeSpeed = 0.25f; ((AnimatedModel)this.DModel).Animation.StartClip("Waiting", true); _amount = 0.0f; _dying = false; _unconscious = false; _attacking = false; _attackMade = false; _endPoints = false; _points = new PointParticle(); _points.AutoInitialize(EngineManager.GameGraphicsDevice, EngineManager.ContentManager, null);//ScreenManager.SpriteBatch); _points.PointsReceived += new EventHandler(PointsHandler); }
/// <summary> /// Create an event handler to control the points. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PointsHandler(object sender, EventArgs e) { // Now that the Splash Screen is done displaying, clean it up. _points.PointsReceived -= new EventHandler(PointsHandler); EngineManager.ParticleManager.ParticleSystem.RemoveParticleSystem(_points); _points.Destroy(); _points = null; }