/// <summary> /// Initializes a new instance of the <see cref="EnemySpawnedMessage"/> class. /// </summary> /// <param name="enemy"> /// The enemy. /// </param> public EnemySpawnedMessage(Enemy enemy) { this.Id = enemy.Id; this.Position = enemy.SimulationState.Position; this.Velocity = enemy.SimulationState.Velocity; this.Rotation = enemy.SimulationState.Rotation; this.MessageTime = NetTime.Now; this.Path = enemy.Path; }
/// <summary> /// The on enemy spawned. /// </summary> /// <param name="enemy"> /// The enemy. /// </param> protected void OnEnemySpawned(Enemy enemy) { EventHandler<SpawnEnemyArgs> enemySpawned = this.EnemySpawned; if (enemySpawned != null) { enemySpawned(this, new SpawnEnemyArgs(enemy)); } }
/// <summary> /// The spawn enemy. /// </summary> /// <param name="id"> /// The id. /// </param> /// <param name="path"> /// The path. /// </param> /// <param name="position"> /// The position. /// </param> /// <param name="velocity"> /// The velocity. /// </param> /// <param name="rotation"> /// The rotation. /// </param> /// <returns> /// </returns> public Enemy SpawnEnemy(long id, int path, Vector2 position, Vector2 velocity, float rotation) { var enemy = new Enemy( id, this.spriteSheet, this.initialEnemyFrame, this.noOfEnemyFrames, this.enemyCollisionRadius, new EntityState { Position = position, Velocity = velocity, Rotation = rotation }, path); for (int x = 0; x < this.pathWaypoints[path].Count; x++) { enemy.AddWaypoiny(this.pathWaypoints[path][x]); } this.enemies.Add(enemy); return enemy; }
/// <summary> /// Initializes a new instance of the <see cref="SpawnEnemyArgs"/> class. /// </summary> /// <param name="enemy"> /// The enemy. /// </param> public SpawnEnemyArgs(Enemy enemy) { this.Enemy = enemy; }