Esempio n. 1
0
    public LevelContext level()
    {
        LevelContext _localctx = new LevelContext(Context, State);

        EnterRule(_localctx, 6, RULE_level);
        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 60; Match(LEVEL_BEGIN);
                State = 61; Match(INTEGER);
                State = 62; Match(COLON);
                State = 63; Match(INTEGER);
                State = 64; Match(LEVEL_END);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Esempio n. 2
0
 		public Level(LevelContext owner, int depth)
 		{
 			Owner = owner;
 			Depth = depth;
 			PreviousLevel = owner.CurrentLevel;
 			Owner.CurrentLevel += Depth;
 		}
Esempio n. 3
0
        protected void CleanupLevelContext()
        {
            var db = new LevelContext();

            db.Levels.RemoveRange(db.Levels.ToArray());
            db.SaveChanges();
        }
Esempio n. 4
0
        protected override void PostBuild(Level level)
        {
            level.OnActorDrop += actor =>
            {
                if (actor.CurrentPlatform == Platforms.First())
                {
                    LevelContext.SuppressHint(RUN_DOWN_HINT);

                    DroppedFromFirstPlatform = true;
                }
            };

            level.OnActorDeath += actor =>
            {
                if (DroppedFromFirstPlatform)
                {
                    LevelContext.DisplayMessage("EPIC");
                }
                else if (_steppedOnHighOneWay)
                {
                    LevelContext.DisplayMessage("Now I'm disappointed");
                }
            };

            _checkpoint.OnActorLanding += actor => level.SaveCheckpoint();
        }
Esempio n. 5
0
        protected override void Build()
        {
            Add(Platform.PassThrough(new Point2(8, 13), width: 3));

            Platforms[0].OnActorLanding += actor => LevelContext.DisplayMessage("That doesn't look too bad...");

            Add(Platform.Concrete(new Point2(15.35, 8.8), width: 0.5, height: 0.5));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayMessage("If it fits, I sits");
            DeathTaunts.Add(Platforms.Last(), "Well yes, but actually no");

            Add(Platform.Concrete(new Point2(18, 7.4), width: 2, height: 2.2));
            DeathTaunts.Add(Platforms.Last(), "Absolutely but not really");

            Add(Platform.Concrete(new Point2(19.5, 7.5), width: 0.5, height: 0.1));
            DeathTaunts.Add(Platforms.Last(), "Maybe this isn't the right game for you");

            _boop = Add(Platform.Concrete(new Point2(18.8, 10.4), width: 0.9, height: 0.9));
            Platforms.Last().OnActorLanding += actor => LevelContext.DisplayMessage("This is exciting! Or is it...");
            DeathTaunts.Add(Platforms.Last(), "So cautious. Yet so dead");

            Add(Platform.Concrete(new Point2(13.1, 3), width: 1, height: 1));
            Platforms.Last().OnActorLanding += actor => LevelContext.DisplayMessage("Captain obvious to the rescue!");
            DeathTaunts.Add(Platforms.Last(), "LOL you knew this would fail");

            Add(Platform.Concrete(new Point2(22.0, 13.0), width: 0.3, height: 8.0));

            Add(Platform.Concrete(new Point2(18.3, 3), width: 2.5));

            Platforms.Last().OnActorLanding += actor => LevelContext.DisplayMessage("Deep in my heart I have always believed in you");
        }
Esempio n. 6
0
        protected override void Build()
        {
            Add(Platform.Concrete(new Point2(6, 3), width: 2));

            Add(Platform.PassThrough(new Point2(9, 5), width: 1));
            Add(Platform.PassThrough(new Point2(9, 4), width: 1));

            Add(Platform.OneWay(new Point2(9, 6), width: 8));
            Platforms.Last().OnActorLanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayHint(SPLITTER_HINT);
                }
            };

            Add(Platform.Flipper(new Point2(9, 6.9)));
            _splitter = Add(Platform.Splitter(new Point2(5, 5.7)));
            Add(Platform.Concrete(new Point2(3, 3.0), width: 1));

            Add(Platform.Concrete(new Point2(10, 6), width: 0.3, height: 1.4));
            Add(Platform.Concrete(new Point2(17.9, 7.3), width: 1.1));
            Add(Platform.Concrete(new Point2(10, 3), width: 4));
            Add(Platform.Concrete(new Point2(19, 7.0), height: 4, width: 0.3));
            Add(Platform.Concrete(new Point2(16, 3), width: 3));
        }
Esempio n. 7
0
        protected override void PostBuild(Level level)
        {
            int numBoops = 0;

            _boop.OnActorColliding += actor =>
            {
                if (actor.Velocity.Y > 0)
                {
                    switch (numBoops)
                    {
                    case 0:
                        LevelContext.DisplayMessage("BOOP");
                        break;

                    case 1:
                        LevelContext.DisplayMessage("BOOP BOOP");
                        break;

                    case 2:
                        LevelContext.DisplayMessage("Are you looking for mushrooms?");
                        break;

                    default:
                        break;
                    }

                    numBoops++;
                }
            };
        }
Esempio n. 8
0
        protected override void Build()
        {
            DeathTaunts.Add(null, "What a shame, I had such high hopes for you");

            const double STEP_WIDTH = 1.2;

            Add(Platform.Concrete(new Point2(2.5, 4), width: STEP_WIDTH));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayHint(JUMP_HINT);

            for (int i = 1; i < 5; i++)
            {
                Add(Platform.Concrete(new Point2(3 + i * i / 2.8 + 2 * i, 4 + i), width: STEP_WIDTH));
            }

            Platforms[2].OnActorStanding += actor =>
            {
                if (actor.Velocity.IsZero)
                {
                    LevelContext.DisplayHint(MOMENTUM_HINT);
                }
            };

            Platforms[3].OnActorStanding += actor => LevelContext.DisplayHint(HOLD_JUMP_HINT);

            DeathTaunts.Add(Platforms[Platforms.Count - 2], "You snooze, you lose");

            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayMessage("You're not too old for this after all!");
        }
Esempio n. 9
0
        public void ComplexTypesShouldBeInserted()
        {
            using (var db = new LevelContext())
            {
                // The level entities are used to test EF complex types.
                var expectedLevels = new[]
                {
                    new Level1
                    {
                        Level2 = new Level2
                        {
                            Level2Name = "L2",
                            Level3     = new Level3
                            {
                                Level3Name = "L3",
                                Updated    = new DateTime(2018, 1, 1)
                            }
                        }
                    }
                };
                db.BulkInsertAll(expectedLevels);

                var actualLevels = db.Levels.ToArray();
                Assert.AreEqual(expectedLevels.Length, actualLevels.Length);
                Assert.AreEqual(expectedLevels[0].Id, actualLevels[0].Id);
                Assert.AreEqual(expectedLevels[0].Level2.Level2Name, actualLevels[0].Level2.Level2Name);
                Assert.AreEqual(expectedLevels[0].Level2.Level3.Level3Name,
                                actualLevels[0].Level2.Level3.Level3Name);
                Assert.AreEqual(expectedLevels[0].Level2.Level3.Updated.Ticks,
                                actualLevels[0].Level2.Level3.Updated.Ticks);
            }
        }
Esempio n. 10
0
 protected override void PostBuild(Level level)
 {
     level.OnActorJump += actor =>
     {
         LevelContext.SuppressHint(JUMP_HINT);
         LevelContext.DisplayMessage("You got it!", seconds: 2);
     };
 }
Esempio n. 11
0
 public WaitingState(GameContext gameContext, LevelContext levelContext, PlayerShip playerShip, ShipsFormation shipsFormation,
                     HudPanel hudPanel)
 {
     _gameContext    = gameContext;
     _levelContext   = levelContext;
     _playerShip     = playerShip;
     _shipsFormation = shipsFormation;
     _hudPanel       = hudPanel;
 }
Esempio n. 12
0
 public IntroState(GameSoundController soundController, HudPanel hudPanel, GameContext gameContext, ShipsFormation shipsFormation,
                   TopPlayersStorage topPlayersStorage, LevelContext levelContext, PlayerShip playerShip)
 {
     _soundController   = soundController;
     _hudPanel          = hudPanel;
     _gameContext       = gameContext;
     _shipsFormation    = shipsFormation;
     _topPlayersStorage = topPlayersStorage;
     _levelContext      = levelContext;
     _playerShip        = playerShip;
 }
Esempio n. 13
0
    private void LoadLevel(string levelName)
    {
        ClearLevel();
        var levelData = levelConfigHash[levelName];

        levelObj = Instantiate(BundleMgr.Instance.GetLevel(levelName), Vector3.zero, Quaternion.identity);
        levelObj.transform.SetParent(levelContainer.transform);
        LevelContext levelContext = levelObj.GetComponent <LevelContext>();

        levelContext.Init(levelData);
    }
Esempio n. 14
0
        public CTI<List<LevelListingView>> GetLevelListing() {
            try {
                using (var levelContext = new LevelContext()) {
                    var result = levelContext.LevelListingDS.ToList();

                    return new CTI<List<LevelListingView>>(result);
                }
            } catch (Exception ex) {
                return new CTI<List<LevelListingView>>(null, ex.ToString());
            }
        }
Esempio n. 15
0
    public void NextLevel()
    {
        if (levelObj == null)
        {
            return;
        }
        LevelContext curLevelContext = levelObj.GetComponent <LevelContext>();

        LoadLevel(curLevelContext.nextLevel);
        if (curLevelContext.isCheckPoint)
        {
            savedLevel = curLevelContext.levelName;
        }
        PlayerPrefs.SetString(PrefsKey.SavedLevel, savedLevel);
        curLevelContext.TeleportPlayer();
    }
Esempio n. 16
0
    private LevelContext CreateContext(LevelData leveldata)
    {
        CardLoader      _cardLoader      = new CardLoader();
        MonsterLoader   monsterLoader    = new MonsterLoader();
        CharacterLoader _characterLoader = new CharacterLoader();

        //init level context
        LevelContext context = new LevelContext();

        context.LevelData = leveldata;
        context.Player    = _characterLoader.LoadUserCharacter();
        context.EnemyList.AddRange(monsterLoader.LoadEnemies(leveldata.Level, leveldata.Mission));
        context.ElementCardList.AddRange(_cardLoader.LoadUserCards(context.Player.Properties.ElementCards));
        context.UltimateCardList.AddRange(_cardLoader.LoadUltimateCards(context.Player.Properties.UltimateCards));

        return(context);
    }
Esempio n. 17
0
        protected override void Build()
        {
            for (int i = 0; i < 2; i++)
            {
                Add(Platform.PassThrough(new Point2(3, 5 + i * 2), width: i + i * i / 6.0 + 3));
            }

            var runDownPlatform = Platforms.Last();

            runDownPlatform.OnActorStanding += actor => LevelContext.DisplayHint(RUN_DOWN_HINT);

            Add(Platform.Concrete(runDownPlatform.Box.TopRight + new Vector2(0.3, 3.7), width: 1, height: 3));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayMessage("Was it especially important to reach here?");

            Add(Platform.Concrete(runDownPlatform.Box.TopRight + new Vector2(0.5, -2), width: 0.6));

            _checkpoint = Add(Platform.Concrete(new Point2(12, 5), width: 3.5));
            Platforms.Last().OnActorStanding += actor =>
            {
                LevelContext.SuppressHint(RUN_DOWN_HINT);
                LevelContext.DisplayMessage("Good!", seconds: 1);
            };

            Add(Platform.PassThrough(new Point2(12, 7), width: 3));

            Add(Platform.PassThrough(new Point2(12, 8), width: 3));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayMessage("Aren't you a genius...");

            Add(Platform.PassThrough(new Point2(12, 9), width: 3));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayHint(ONE_WAY_HINT);

            Add(Platform.OneWay(new Point2(11, 10), width: 9));

            Add(Platform.OneWay(new Point2(10, 11), width: 12));
            _highOneWayPlatform = Platforms.Last();

            _highOneWayPlatform.OnActorStanding += actor =>
            {
                _steppedOnHighOneWay = true;
                LevelContext.SuppressHint(ONE_WAY_HINT);
                LevelContext.DisplayMessage("But it may disappoint you");
            };

            Add(Platform.PassThrough(new Point2(21, 8), width: 1));
        }
Esempio n. 18
0
        internal CTI<LevelResponseItem> GetLevel(int levelID) {
            try {
                using (var levelContext = new LevelContext()) {
                    var result = levelContext.LevelVIEWDS.FirstOrDefault(a => a.ID == levelID);

                    if (result == null) { return new CTI<LevelResponseItem>(null, "Could not load level"); }

                    var response = new LevelResponseItem {
                        LevelData = result.Data,
                        Description = result.Name
                    };

                    return new CTI<LevelResponseItem>(response);
                }
            } catch (Exception ex) {
                return new CTI<LevelResponseItem>(null, ex.ToString());
            }
        }
Esempio n. 19
0
    public Contexts()
    {
        game  = new GameContext();
        input = new InputContext();
        level = new LevelContext();
        meta  = new MetaContext();
        uI    = new UIContext();

        var postConstructors = System.Linq.Enumerable.Where(
            GetType().GetMethods(),
            method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute))
            );

        foreach (var postConstructor in postConstructors)
        {
            postConstructor.Invoke(this, null);
        }
    }
Esempio n. 20
0
        protected override void PostBuild(Level level)
        {
            level.Munches.Add(new Munch(new Point2(21.15, 9.9)));
            level.Door.Size = 2;

            _checkpoint.OnActorLanding += actor =>
            {
                if (actor.Size == 2)
                {
                    level.SaveCheckpoint();
                }
            };

            Platforms.Last().OnActorLanding += actor =>
            {
                if (actor.Size == level.Door.Size)
                {
                    LevelContext.DisplayMessage("Or a woman of culture.\n" + "I don't know, I can't really see...");
                }
                else
                {
                    LevelContext.DisplayMessage("You're too small for this world");
                }
            };

            level.OnActorMunch += (actor, munch) =>
            {
                actor.Location += new Vector2(-actor.Width / 2, actor.Height / 2);

                LevelContext.DisplayMessage("Yum! Big boys can jump higher!");
                actor.Velocity = Vector2.ZERO;
            };

            level.OnActorJump += actor =>
            {
                if (actor.Size == 2)
                {
                    LevelContext.DisplayMessage("Jumping higher is a good thing! Right?...");
                }
            };
        }
Esempio n. 21
0
        protected override void Build()
        {
            Add(Platform.Concrete(new Point2(1, 9.5), width: 2));

            for (int i = 0; i < 5; i++)
            {
                Add(Platform.Concrete(new Point2(3 + i * i / 6.5 + i * 2, 9.5 - i), width: 1.3));
            }

            Platforms[0].OnActorStanding += actor => LevelContext.DisplayHint(RIGHT_HINT);

            Platforms[2].OnActorStanding += actor =>
            {
                LevelContext.SuppressHint(RIGHT_HINT);
                LevelContext.DisplayMessage("Good. Was just making sure you have pulse", seconds: 2);
            };

            DeathTaunts.Add(Platforms[4], "Stop being so insecure!");
            DeathTaunts.Add(Platforms[5], "You're a goner");

            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayHint(DOOR_HINT);
        }
Esempio n. 22
0
    public LevelContext level()
    {
        LevelContext _localctx = new LevelContext(Context, State);

        EnterRule(_localctx, 4, RULE_level);
        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 28; Match(INTEGER);
                State = 29; Match(AT);
                State = 30; Match(INTEGER);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Esempio n. 23
0
    // Testing
    public void Initialize(LevelContext context)
    {
        //init battle context
        this._battleContext = new BattleContext();
        DataManager.Instance.BattleContext = this._battleContext;

        _battleContext.EnemyList           = new ListenableList <EnemyInstance>();
        _battleContext.ActorList           = new ListenableList <Actor>();
        _battleContext.CurrentActor        = new ListenableProperty <Actor>(null);
        _battleContext.UltimateCard        = new ListenableProperty <UltimateCardInstance>(null);
        _battleContext.HightLightCardsList = new ListenableList <ElementCardInstance>();

        // Load Characters
        _battleContext.Player = context.Player;
        _battleContext.ActorList.AddItem(_battleContext.Player);

        // Load Cards
        _battleContext.Player.CardDeck.AddItems(context.ElementCardList);
        _battleContext.Player.CardDeck.Shuffle();
        _battleContext.UltimateCards = context.UltimateCardList;

        // Load Enemy
        _battleContext.EnemyList.AddItems(context.EnemyList);
        _battleContext.ActorList.AddItems(_battleContext.EnemyList.GetAll());

        // Binding View
        OnBindView();

        // Register event listeners
        RegisterEvent();

        // Initialization
        _battleContext.TurnNumber = 0;

        // Start
        StartTurn();
    }
Esempio n. 24
0
    static void PlayMusic(LevelContext Context)
    {
        var source = LevelMusic;

        LevelMusic.Stop();
        string file = "res4.ogg";

        switch (Context)
        {
        case LevelContext.BEACH:
            file = "res5.ogg";
            break;

        case LevelContext.FIELDS:
            file = "res4.ogg";
            break;

        case LevelContext.KELP:
            file = "res6.ogg";
            break;

        case LevelContext.CAVES:
            file = "res5.ogg";
            break;
        }
        string fileName = Path.Combine(AssetDirectory, "music", file);
        WWW    data     = new WWW(fileName);

        while (!data.isDone)
        {
        }
        AudioClip ac = data.GetAudioClipCompressed(false, AudioType.OGGVORBIS) as AudioClip;

        ac.name     = Enum.GetName(typeof(LevelContext), Context) + " Level Music";
        source.clip = ac;
        source.Play();
    }
Esempio n. 25
0
        protected override void PostBuild(Level level)
        {
            level.Door.Size = 2;

            level.Munches.Add(new Munch(new Point2(9, 2.5)));

            _checkpoint1.OnActorChangedOrientation += actor => level.SaveCheckpoint();

            _checkpoint2.OnActorLanding += actor =>
            {
                if (actor.Size == 2 && actor.Orientation == ActorOrientation.TALL)
                {
                    level.SaveCheckpoint();
                }
            };

            level.OnActorMunch += (actor, munch) =>
            {
                if (actor.Orientation == ActorOrientation.TALL)
                {
                    LevelContext.DisplayMessage("You know what to do now... Right?");
                }
            };
        }
Esempio n. 26
0
        protected override void Build()
        {
            Add(Platform.Concrete(new Point2(7, 3), width: 1, height: 0.3));
            Platforms.Last().OnActorLanding += actor => LevelContext.DisplayMessage("Find your inner peace");

            _checkpoint = Add(Platform.OneWay(new Point2(7, 7), width: 4.5));

            Add(Platform.PassThrough(new Point2(16.9, 8), width: 0.3));

            Add(Platform.OneWay(new Point2(18.3, 5), width: 1.5));
            DeathTaunts.Add(Platforms.Last(), "Such lack of creativity");

            Add(Platform.OneWay(new Point2(10, 9), width: 3.7));

            Add(Platform.OneWay(new Point2(15.6, 9), width: 5.4));
            Platforms.Last().OnActorLanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("Just do it");
                }
            };

            Add(Platform.PassThrough(new Point2(19, 8), width: 1.3));
            Platforms.Last().OnActorLanding += actor =>
            {
                if (actor.Size == 2)
                {
                    LevelContext.DisplayMessage("Ah! I see you are a man of culture");
                }
            };

            Add(Platform.OneWay(new Point2(14.3, 7), width: 2));
            Add(Platform.PassThrough(new Point2(9, 4), width: 1.5));
            Add(Platform.PassThrough(new Point2(10.5, 8), width: 2.6));
            Add(Platform.PassThrough(new Point2(20, 7), width: 1));
            Add(Platform.PassThrough(new Point2(12.9, 4), width: 1.5));
            Add(Platform.OneWay(new Point2(13.2, 5), width: 1.5));
            DeathTaunts.Add(Platforms.Last(), "You should use your head for thinking");

            Add(Platform.Concrete(new Point2(14.5, 3), width: 1.3, height: 0.3));
            DeathTaunts.Add(Platforms.Last(), "Suicide is never the answer");

            Add(Platform.Concrete(new Point2(16, 5.3), width: 0.3, height: 0.3));
            Add(Platform.Concrete(new Point2(18, 5.3), width: 0.3, height: 0.3));
            DeathTaunts.Add(Platforms.Last(), "Epic fail");

            Add(Platform.Concrete(new Point2(14, 7), width: 0.3, height: 0.3));
            Add(Platform.Concrete(new Point2(13.7, 9.3), width: 0.3, height: 0.3));
            Add(Platform.Concrete(new Point2(17.8, 3), width: 1, height: 0.3));
            Add(Platform.Concrete(new Point2(20.2, 3.8), width: 0.3));
            DeathTaunts.Add(Platforms.Last(), "Wow, you really blew it this time!");

            Add(Platform.Concrete(new Point2(21, 8), width: 0.3, height: 0.5));
            Add(Platform.Concrete(new Point2(21, 16.5), width: 0.3, height: 4));
            Add(Platform.Concrete(new Point2(21, 10.8), width: 0.3, height: 0.8));
            Add(Platform.Concrete(new Point2(15.1, 11.2), width: 0.3, height: 0.3));
            Add(Platform.Concrete(new Point2(17.5, 11.5), width: 0.3, height: 0.3));
            Add(Platform.OneWay(new Point2(10, 12), width: 11));
            Add(Platform.Concrete(new Point2(23.5, 4), width: 4, height: 0.3));
        }
Esempio n. 27
0
 protected override void PostBuild(Level level)
 {
     level.CanActorJump = false;
     level.OnActorJump += actor => LevelContext.DisplayMessage("When exactly did we say you can jump?");
 }
Esempio n. 28
0
        protected override void PostBuild(Level level)
        {
            level.Door.Size = 2;

            var upperMunch = new Munch(new Point2(12, 7.5));
            var lowerMunch = new Munch(new Point2(11.5, 4.6));

            level.Munches.Add(upperMunch);
            level.Munches.Add(lowerMunch);

            level.OnActorMunch += (actor, munch) =>
            {
                if (actor.Size > 2)
                {
                    LevelContext.DisplayMessage("Not body shaming or anything, but you're quite large");
                }
                else if (actor.Orientation != ActorOrientation.SQUARE)
                {
                    if (munch == lowerMunch)
                    {
                        LevelContext.DisplayMessage("You're in for a disappointment mate");
                    }
                    else
                    {
                        LevelContext.DisplayMessage("Good luck with that one");
                    }
                }
            };

            _splitter.OnActorColliding += actor =>
            {
                LevelContext.DisplayMessage("Why like this...");
            };

            _splitter.OnActorSplit += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("Two are better than one!");
                    LevelContext.SuppressHint(SPLITTER_HINT);

                    level.SaveCheckpoint();
                }
                else
                {
                    LevelContext.DisplayMessage("This ain't gonna work");
                }
            };

            level.OnActorUnion += actor =>
            {
                if (actor.Size == 2 && actor.Orientation == ActorOrientation.TALL)
                {
                    LevelContext.DisplayMessage("Make rectangles great again!");
                }
                else
                {
                    LevelContext.DisplayMessage("What the hell is this?");
                }
            };
        }
Esempio n. 29
0
    public AIMindlessWanderSystem(Contexts contexts)
    {
        _entities = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.AI, GameMatcher.Acting));

        _levelContext = contexts.level;
    }
Esempio n. 30
0
 public IncomingWaveState(ShipsFormation shipsFormation, LevelContext levelContext)
 {
     _shipsFormation = shipsFormation;
     _levelContext   = levelContext;
 }
 public MovementCollisionSystem(Contexts contexts) : base(contexts.game)
 {
     _gameContext  = contexts.game;
     _levelContext = contexts.level;
 }
Esempio n. 32
0
        protected override void Build()
        {
            _checkpoint2 = Add(Platform.OneWay(new Point2(2, 8), width: 9));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayHint(POINT_HINT);
                }
                else
                {
                    LevelContext.DisplayMessage("Don't think twice, it's alright");
                }
            };

            Add(Platform.OneWay(new Point2(2, 9), width: 2));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayHint(POINT_HINT);

            Add(Platform.Flipper(bottomLeft: new Point2(4.5, 9.9)));

            var lowVelocityFails = 0;
            var verticalVelocityUnnecessaryFails = 0;

            Platforms.Last().OnActorColliding += actor =>
            {
                if (actor.Orientation == ActorOrientation.FLAT)
                {
                    LevelContext.DisplayMessage("You're flat out missing the point.\n" +
                                                "There were two puns in that sentence.", seconds: 7);
                }
                else if (actor.Velocity.Y < -2)
                {
                    if (verticalVelocityUnnecessaryFails == 0)
                    {
                        LevelContext.DisplayMessage("You're heading in the wrong direction! I mean, generally in life, it's not a clue or anything", seconds: 7);
                    }
                    else
                    {
                        LevelContext.DisplayMessage("What are your expectations from doing this?");
                    }

                    verticalVelocityUnnecessaryFails++;
                }
                else if (actor.Velocity.Y > 0)
                {
                    LevelContext.DisplayMessage("Not like this!");
                }
                else if (actor.Velocity.X > 2.0)
                {
                    if (lowVelocityFails == 0)
                    {
                        LevelContext.DisplayMessage("Have you forgotten your breakfast?\n" +
                                                    "They are STRONGLY recommended!", seconds: 10);
                    }
                    else
                    {
                        LevelContext.DisplayMessage("It's not about hitting the point as much as it's about hitting yourself with the point", seconds: 10);
                    }

                    lowVelocityFails++;
                }
            };

            Platforms.Last().OnActorChangedOrientation += actor =>
            {
                LevelContext.SuppressHint(POINT_HINT);

                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("VROOM VROOM! All aboard on the bullet... ehm... brain?", seconds: 7);
                }
                else if (actor.Orientation == ActorOrientation.FLAT)
                {
                    LevelContext.DisplayMessage("I'll just assume that was by mistake. Wink, wink");
                }
                else
                {
                    LevelContext.DisplayMessage("You were once so naive.\n" +
                                                "Now you think you've got everything sorted out.", seconds: 7);
                }
            };

            Add(Platform.OneWay(new Point2(8, 9), width: 1.5));
            Add(Platform.OneWay(new Point2(7, 10), width: 3));
            Add(Platform.Concrete(new Point2(19, 2), width: 2));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Orientation == ActorOrientation.FLAT)
                {
                    LevelContext.DisplayMessage("Are you f****d or what? Am I right guys?");
                }
            };

            Add(Platform.Flipper(bottomLeft: new Point2(18.5, 2.9)));
            Platforms.Last().OnActorChangedOrientation += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("That was soooo down to earth man");
                }
                else
                {
                    LevelContext.DisplayMessage("Do you have De ja vu?", seconds: 2);
                }
            };

            Add(Platform.PassThrough(new Point2(20, 4), width: 1));
            Add(Platform.PassThrough(new Point2(20, 6), width: 1));
            Add(Platform.OneWay(new Point2(18, 8), width: 12));

            _checkpoint1 = Add(Platform.Flipper(bottomLeft: new Point2(26, 10.4)));
            Platforms.Last().OnActorChangedOrientation += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("You grew up so fast... sniff");
                }
                else
                {
                    LevelContext.DisplayMessage("Do you have De ja vu again??");
                }
            };

            Add(Platform.PassThrough(new Point2(8, 4), width: 2));
            Platforms.Last().OnActorStanding += actor => LevelContext.DisplayMessage(
                "If you liked this game so far, well... be prepared to hate your own life as well", seconds: 7);

            Add(Platform.Concrete(new Point2(2, 1), width: 9));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Orientation == ActorOrientation.FLAT)
                {
                    LevelContext.DisplayMessage("It is possible that you will begin losing your mind just about... now", seconds: 7);
                }
            };

            Add(Platform.Flipper(bottomLeft: new Point2(4, 2)));
            Platforms.Last().OnActorChangedOrientation += actor =>
            {
                LevelContext.DisplayMessage("You've figured something out on your own! That's new!");
            };

            Add(Platform.Concrete(new Point2(12.8, 10), width: 0.2, height: 0.5));

            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("You have just unlocked a new ability: Uselesness", seconds: 7);
                }
                else if (actor.Orientation == ActorOrientation.FLAT)
                {
                    LevelContext.DisplayMessage("Well well well. Look who's back in town");
                }
            };

            Platforms.Last().OnActorColliding += actor =>
            {
                if (actor.Velocity.X >= 0)
                {
                    LevelContext.DisplayMessage("Yes, yes, but why?");
                }
                else
                {
                    LevelContext.DisplayMessage("It's a shame to see you go");
                }
            };

            Add(Platform.Concrete(new Point2(12.8, 16), width: 0.2, height: 0.2));
            Add(Platform.Concrete(new Point2(12.8, 15), width: 0.2, height: 2.7));
            Platforms.Last().OnActorColliding += actor =>
            {
                if (actor.Velocity.X < 0)
                {
                    LevelContext.DisplayMessage("I would pity you but I'm not human");
                }
            };

            Add(Platform.PassThrough(new Point2(21.5, 9.5), width: 4.5));

            Add(Platform.OneWay(new Point2(21, 11), width: 5));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("Did you lose something here?");
                }
            };

            Add(Platform.OneWay(new Point2(5, 10), width: 5));
            Add(Platform.OneWay(new Point2(7.25, 10.75), width: 0.5));
            Add(Platform.OneWay(new Point2(6.5, 12), width: 2.1));
            Add(Platform.PassThrough(new Point2(3, 12.9), width: 6));

            Add(Platform.OneWay(new Point2(2.5, 13.6), width: 7));
            Add(Platform.OneWay(new Point2(2, 14), width: 8));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("Remind me of your strategy...");
                }
                else if (actor.Orientation == ActorOrientation.TALL)
                {
                    LevelContext.DisplayMessage("The cake was a lie");
                }
            };

            Add(Platform.Concrete(new Point2(5, 12.3), width: 0.3, height: 1.8));

            Add(Platform.Concrete(new Point2(10, 12.8), width: 0.3, height: 0.6));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("Define 'pointless'");
                }
            };

            Add(Platform.Concrete(new Point2(10, 15.1), width: 0.3, height: 0.2));
            Platforms.Last().OnActorColliding += actor =>
            {
                if (actor.Size == 2)
                {
                    LevelContext.DisplayMessage("Muhahahaha");
                }
            };

            Add(Platform.Concrete(new Point2(2, 17.3), width: 10));

            Add(Platform.Concrete(new Point2(10.8, 11.3), width: 1.5));
            Platforms.Last().OnActorStanding += actor =>
            {
                if (actor.Size == 1)
                {
                    LevelContext.DisplayMessage("It's nice think that being a KNOB should be enough to open this door, isn't it?", seconds: 7);
                }
                else if (actor.Orientation == ActorOrientation.FLAT)
                {
                    LevelContext.DisplayMessage("May I help you?");
                }
            };
        }