Example #1
0
        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));
        }
Example #2
0
 public override void CreateBots(List <Player> players, int suggestedCount, BotType type)
 {
     for (int i = 0; i < suggestedCount; ++i)
     {
         players.Add(GameLevelManager.CreateBot(type, players));
     }
 }
Example #3
0
        public override void OnObjectDestroyed(ISceneObject obj)
        {
            if (!(obj is Asteroid))
            {
                return;
            }

            obj = ServerSceneObjectFactory.CreateNewAsteroidOnEdge(mgr, (obj as Asteroid).IsHeadingRight);
            GameLevelManager.SendNewObject(mgr, obj);
            objects.Add(obj);
        }
Example #4
0
        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))));
        }
Example #5
0
        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)));
        }
 public LevelTestPoweUp(ServerMgr serverMgr) : base(serverMgr)
 {
     events.AddEvent(1, new Event(0.2f, EventType.REPEATABLE, new Action(() => GameLevelManager.CreateAndSendNewStatPowerup(mgr))));
 }
 private void CreateAndSendNewStatPowerup()
 {
     GameLevelManager.CreateAndSendNewStatPowerup(mgr);
     events.RescheduleEvent((int)Events.NEW_STAT_POWERUP, mgr.GetRandomGenerator().Next(SharedDef.NEW_STAT_POWERUP_TIMER_MIN, SharedDef.NEW_STAT_POWERUP_TIMER_MAX + 1));
 }