private EnemyModel CreateEnemyModel() { EnemyModel enemyModel = new EnemyModel(_game); enemyModel.Front = new Vector2(0, -1); enemyModel.Mass = .2f; enemyModel.Scale = Mathematics.Lerp(.4f, .8f, (float)_rnd.NextDouble()); enemyModel.MaxSpeed = (float)Mathematics.Lerp(_enemyMaxSpeedLowRange, _enemyMaxSpeedHighRange, (float)_rnd.NextDouble()); enemyModel.MaxForce = (float)Mathematics.Lerp(_enemyMaxForceLowRange, _enemyMaxForceHighRange, (float)_rnd.NextDouble()); int quadrant = _rnd.Next(1, 5); switch (quadrant) { case 1: enemyModel.Position = new Vector2((float)_rnd.NextDouble() * Width, -_enemyCreationBufferWidth); break; case 2: enemyModel.Position = new Vector2(Width + _enemyCreationBufferWidth, (float)_rnd.NextDouble() * Height); break; case 3: enemyModel.Position = new Vector2((float)_rnd.NextDouble() * Width, Width + _enemyCreationBufferWidth); break; default: enemyModel.Position = new Vector2(-_enemyCreationBufferWidth, (float)_rnd.NextDouble() * Height); break; } enemyModel.Initialize(); return(enemyModel); }
public void SendEnemyWave(int n) { for (int i = 0; i < n; i++) { EnemyModel enemyModel = CreateEnemyModel(); enemyModel.Add(new PursueAgentBehavior(_enemyAtBugThreshold, _enemyPredictionFactor, BugModel)); enemyModel.Add(new SeperationBehavior(_enemySeperationFactor, _enemyList)); _enemyList.Add(enemyModel); if (EnemyAdded != null) { EnemyAdded(this, new EnemyAddedEventArgs(enemyModel)); } } }
private EnemyModel CreateEnemyModel() { EnemyModel enemyModel = new EnemyModel(_game); enemyModel.Front = new Vector2(0, -1); enemyModel.Mass = .2f; enemyModel.Scale = Mathematics.Lerp(.4f, .8f, (float)_rnd.NextDouble()); enemyModel.MaxSpeed = (float)Mathematics.Lerp(_enemyMaxSpeedLowRange, _enemyMaxSpeedHighRange, (float)_rnd.NextDouble()); enemyModel.MaxForce = (float)Mathematics.Lerp(_enemyMaxForceLowRange, _enemyMaxForceHighRange, (float)_rnd.NextDouble()); int quadrant = _rnd.Next(1, 5); switch (quadrant) { case 1: enemyModel.Position = new Vector2((float)_rnd.NextDouble() * Width, -_enemyCreationBufferWidth); break; case 2: enemyModel.Position = new Vector2(Width + _enemyCreationBufferWidth, (float)_rnd.NextDouble() * Height); break; case 3: enemyModel.Position = new Vector2((float)_rnd.NextDouble() * Width, Width + _enemyCreationBufferWidth); break; default: enemyModel.Position = new Vector2(-_enemyCreationBufferWidth, (float)_rnd.NextDouble() * Height); break; } enemyModel.Initialize(); return enemyModel; }
public EnemyAddedEventArgs(EnemyModel enemyModel) { this.EnemyModel = enemyModel; }