private void AddEnemySpawning() { var values = new EnemyCreationValues(); //values.Spline = SplinePaths.Find(item=>item.Name == "LtoRLoop"); //values.Count = 5; //values.Delay = 3; //values.EnemyInfo = GlobalContent.EnemyInfo[EnemyInfo.Regular]; //CreateEnemyShips(values); //for(int i = 0; i < 10; i++) //{ // values = new EnemyCreationValues(); // values.Spline = SplinePaths.Find(item=>item.Name == "DownThenUp"); // values.Count = 1; // values.Delay = 10 + i/2.0f; // values.EnemyInfo = GlobalContent.EnemyInfo[EnemyInfo.Regular]; // values.Offset = new Vector3(-300 + i * 600 / 10, 0, 0); // CreateEnemyShips(values); //} values = new EnemyCreationValues(); values.Delay = 1; //values.Delay = 15; values.EnemyInfo = GlobalContent.EnemyInfo[EnemyInfo.ExtraBig]; values.Spline = SplinePaths.Find(item => item.Name == "LeftToRight"); values.SplinePointToLoopTo = 2; values.Count = 1; CreateEnemyShips(values); }
void CreateEnemyShips(EnemyCreationValues values) { this.Call(() => { for (int i = 0; i < values.Count; i++) { this.Call(() => { var enemyShip = EnemyShipFactory.CreateNew(); // Move it off screen, it'll adjust its positing // in its custo activity using the spline enemyShip.X = -10000; enemyShip.SplinePointToLoopTo = values.SplinePointToLoopTo; enemyShip.SplineOffset = values.Offset; enemyShip.SplineFollowing = values.Spline; enemyShip.EnemyInfo = values.EnemyInfo; }) .After(i * values.TimeSeparation); } }).After(values.Delay); }