Exemplo n.º 1
0
        public GameSceneController()
        {
            Tag(TAG);

            switch (Network.ActiveSession[0].Value)
            {
                case 0:
                    MotionMultiplier = 0.75f;
                    break;
                case 1:
                    MotionMultiplier = 1.0f;
                    break;
                case 2:
                    MotionMultiplier = 1.4f;
                    break;
            }

            SideWallsEnabled = Network.ActiveSession[1] == 1;
            BombsAllowed = true;

            updateBombAlarm = new Alarm(AlarmMode.Loop, OnUpdateBombAlarm, 2, false);
            updateShipAlarm = new Alarm(AlarmMode.Loop, OnUpdateShipAlarm, 3, false);
            gameStartAlarm = new Alarm(AlarmMode.Single, OnGameStartAlarm, 30, true);
            gameEndAlarm = new Alarm(AlarmMode.Single, OnGameEndAlarm, 30, false);
            Add(updateBombAlarm, updateShipAlarm, gameStartAlarm, gameEndAlarm);

            Network.FirstLocalGamer.Actions = new Actions(this);

            bombSwitchBinding = new InputBinding();
            bombSwitchBinding.DefineGamePadIndex(0).DefineInputType(InputType.Pressed)
                .Add(Keys.B).Add(Buttons.LeftStick);

            quitBinding = new InputBinding();
            quitBinding.DefineGamePadIndex(0).DefineInputType(InputType.Pressed)
                .Add(Keys.Escape).Add(Buttons.Back);

            HookEvents();
        }
Exemplo n.º 2
0
 public static Alarm Add(Entity entity, Action onComplete, int duration, AlarmMode mode = AlarmMode.Single)
 {
     Alarm alarm = new Alarm(mode, onComplete, duration, true);
     entity.Add(alarm);
     return alarm;
 }