Пример #1
0
        //Multiplayer character selection callback, stores the selected characters and moves on to map selection
        LevelSelection _MpCSCallback(CharSelection cs, PackedScene p1, PackedScene p2)
        {
            //Disable all new connections
            this.peer.RefuseNewConnections = true;

            LevelSelection ls = this._LocalCSCallback(cs, p1, p2);

            ls.SetMp(Lobby.role);

            return(ls);
        }
Пример #2
0
        int _LSCallback(LevelSelection ls, PackedScene level)
        {
            //Remove level selection
            GetTree().Root.RemoveChild(ls);

            this.levelScene = level;

            //Create and goto level
            this.GameCreate(level);

            //Add the players
            this.AddPlayer("p1", this.p1Id, this.p1Scene);
            this.AddPlayer("p2", this.p2Id, this.p2Scene);

            //Start the game
            this.GameStart();
            return(0);
        }
Пример #3
0
        //Local character selection callback, stores the selected characters and moves on to level selection
        //Returns the new level selection
        LevelSelection _LocalCSCallback(CharSelection cs, PackedScene p1, PackedScene p2)
        {
            //Removes the charselection
            GetTree().Root.RemoveChild(cs);

            //Stores player choices
            this.p1Scene = p1;
            this.p2Scene = p2;

            //Moves to level selection
            LevelSelection ls = (ResourceLoader.Load("res://scenes/ui/level_selection.tscn") as PackedScene).Instance()
                                as LevelSelection;

            ls.SetCallback(this._LSCallback);
            GetTree().Root.AddChild(ls);

            Lobby.state = GameState.LEVEL_SELECTION;

            return(ls);
        }