public override void OnStart() { Rect baseLoc = PlayerBaseLocation.GetBaseLocation(PlayerPosition.LEFT); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 10, new Vector(baseLoc.X - 10 * 2 - 1, 100), new Vector(0, 0), AsteroidType.NORMAL))); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 20, new Vector(baseLoc.X - 20 * 2, 200), new Vector(0, 0), AsteroidType.NORMAL))); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 10, new Vector(baseLoc.X + baseLoc.Width + 1, 100), new Vector(0, 0), AsteroidType.NORMAL))); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 20, new Vector(baseLoc.X + baseLoc.Width, 200), new Vector(0, 0), AsteroidType.NORMAL))); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 20, new Vector(300, 200), new Vector(0, 0), AsteroidType.GOLDEN))); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 20, new Vector(500, 200), new Vector(0, 0), AsteroidType.GOLDEN))); StatPowerUp sp = CreateNewStatPowerup(); sp.Position = new Vector(100, 100); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(sp)); sp = CreateNewStatPowerup(); sp.Position = new Vector(100, 200); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(sp)); sp = CreateNewStatPowerup(); sp.Position = new Vector(200, 100); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(sp)); sp = CreateNewStatPowerup(); sp.Position = new Vector(200, 200); GameLevelManager.SendNewObject(mgr, MakeObjectStatic(sp)); }
private void CreateAndSendNewAsteroid(int step) { Asteroid a = null; switch (step) { case 1: a = ServerSceneObjectFactory.CreateCustomAsteroid(mgr, radius, new Vector(500, 200), new Vector(0, 1), AsteroidType.NORMAL); a.GetControlOfType <IMovementControl>().Speed = 100; break; case 2: a = ServerSceneObjectFactory.CreateCustomAsteroid(mgr, radius, new Vector(500, 200), new Vector(1, 1).NormalizeV(), AsteroidType.NORMAL); a.GetControlOfType <IMovementControl>().Speed = 100; break; case 3: a = ServerSceneObjectFactory.CreateCustomAsteroid(mgr, radius, new Vector(500, 300), new Vector(1, 0), AsteroidType.NORMAL); a.GetControlOfType <IMovementControl>().Speed = 100; break; case 4: a = ServerSceneObjectFactory.CreateCustomAsteroid(mgr, radius / 2, new Vector(500, 300), new Vector(-1, 0), AsteroidType.NORMAL); a.GetControlOfType <IMovementControl>().Speed = 100; break; case 5: a = ServerSceneObjectFactory.CreateCustomAsteroid(mgr, radius, new Vector(550, 400), new Vector(0, -1), AsteroidType.NORMAL); a.GetControlOfType <IMovementControl>().Speed = 60; break; case 6: a = ServerSceneObjectFactory.CreateCustomAsteroid(mgr, radius, new Vector(500, 400), new Vector(1, -1).NormalizeV(), AsteroidType.NORMAL); a.GetControlOfType <IMovementControl>().Speed = 40; break; default: break; } a.TextureId = 4; a.RemoveControlsOfType <LinearRotationControl>(); GameLevelManager.SendNewObject(mgr, a); step++; if (step > 6) { step = 1; } events.AddEvent(step, new Event(timer, EventType.ONE_TIME, new Action(() => CreateAndSendNewAsteroid(step)))); }
public override void OnStart() { Rect baseLoc = PlayerBaseLocation.GetBaseLocation(PlayerPosition.LEFT); GameLevelManager.SendNewObject(mgr, ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 10, new Vector(baseLoc.X - 10 * 2 - 1, 100), new Vector(0, 1), AsteroidType.NORMAL)); GameLevelManager.SendNewObject(mgr, ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 20, new Vector(baseLoc.X - 20 * 2, 200), new Vector(0, 1), AsteroidType.NORMAL)); GameLevelManager.SendNewObject(mgr, ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 10, new Vector(baseLoc.X + baseLoc.Width + 1, 100), new Vector(0, 1), AsteroidType.NORMAL)); GameLevelManager.SendNewObject(mgr, ServerSceneObjectFactory.CreateCustomAsteroid( mgr, 20, new Vector(baseLoc.X + baseLoc.Width, 200), new Vector(0, 1), AsteroidType.NORMAL)); baseLoc = PlayerBaseLocation.GetBaseLocation(PlayerPosition.RIGHT); GameLevelManager.SendNewObject(mgr, CreateAndSendNewStatPowerup(new Vector(baseLoc.X - 10 * 2 - 1, 100), new Vector(0, 1))); GameLevelManager.SendNewObject(mgr, CreateAndSendNewStatPowerup(new Vector(baseLoc.X - 20 * 2, 200), new Vector(0, 1))); GameLevelManager.SendNewObject(mgr, CreateAndSendNewStatPowerup(new Vector(baseLoc.X + baseLoc.Width + 1, 100), new Vector(0, 1))); GameLevelManager.SendNewObject(mgr, CreateAndSendNewStatPowerup(new Vector(baseLoc.X + baseLoc.Width, 200), new Vector(0, 1))); }