Beispiel #1
0
        public override async Task Enter(Dictionary <string, object> parameters)
        {
            var levelMaker = new LevelMaker();

            CamX        = 0;
            CamY        = 0;
            Level       = levelMaker.Generate(100, 10);
            TileMap     = Level.TileMap;
            Background  = Super50Bros.Instance.Random.Next(3);
            BackgroundX = 0;

            GravityOn     = true;
            GravityAmount = 6 * 60; // ~60 FPS

            Player = new Player(
                0, 0,
                16, 20,
                "green-alien",
                null,
                TileMap,
                Level
                );

            Player.StateMachine = new StateMachine(new Dictionary <string, State>
            {
                ["idle"]    = new PlayerIdleState(Player),
                ["walking"] = new PlayerWalkingState(Player),
                ["jump"]    = new PlayerJumpState(Player, GravityAmount),
                ["falling"] = new PlayerFallingState(Player, GravityAmount)
            });

            await SpawnEnemies();

            await Player.ChangeState("falling");
        }
Beispiel #2
0
        public override void Update(GameTime gameTime)
        {
            if (InputHandler.IsKeyJustPressed(Keys.Up) || InputHandler.IsKeyJustPressed(Keys.Down))
            {
                highlighted = highlighted == 0 ? 1 : 0;
                Constants.G_SOUNDS_PADDLE_HIT.Play();
            }

            if (InputHandler.IsKeyJustPressed(Keys.Enter))
            {
                Constants.G_SOUNDS_CONFIRM.Play();
                if (highlighted == 0)
                {
                    Paddle       paddle     = new Paddle(this.Game, GameRef.SpriteBatch);
                    List <Brick> bricks     = LevelMaker.CreateMap(this.Game, GameRef.SpriteBatch, random);
                    ServeState   serveState = new ServeState(this.Game, paddle, 3, 0, bricks);
                    manager.ChangeState(serveState);
                }
            }

            if (InputHandler.IsKeyJustPressed(Keys.Escape))
            {
                Game.Exit();
            }

            base.Update(gameTime);
        }
Beispiel #3
0
    public static void OpenWindow()
    {
        LevelMaker myWindow = (LevelMaker)GetWindow(typeof(LevelMaker));

        myWindow.wantsMouseMove = true;
        myWindow.Show();
    }
Beispiel #4
0
        public PaddleSelectState()
        {
            // the paddle we're highlighting; will be passed to the ServeState
            // when we press Enter
            currentPaddle = 0;

            levelMaker = new LevelMaker();
        }
Beispiel #5
0
 void Start()
 {
     if (!player)
     {
         player = GameObject.FindGameObjectWithTag("Player").GetComponent <ActiveObjectProperties>();
     }
     levelMaker = GameObject.Find("LEVEL_MAKER").GetComponent <LevelMaker>();
     audioMixer.SetFloat("lowpass_effects", 22000);
     audioMixer.SetFloat("volume_effects", 0);
 }
Beispiel #6
0
        public override Task Enter(Dictionary <string, object> parameters)
        {
            var levelMaker = new LevelMaker();

            Map        = levelMaker.Generate(100, 10);
            Background = Super50Bros.Instance.Random.Next(3);

            var height = Super50Bros.Instance.Textures["backgrounds"].Height;

            return(Task.CompletedTask);
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        LevelMaker ld = (LevelMaker)target;

        if (GUILayout.Button("Generate Level"))
        {
            ld.CreateLevel();
        }
    }
Beispiel #8
0
    private int newRoomIndex; //used to find a room to place the exit in (which will need to be different than the key)
    #endregion

    //At the beginning of the program, get all necessary components for the level,
    //reset the values of the indexs and locations, reset level count to 1, display the
    //level number, and reset the timer.
    void Start()
    {
        thisKey   = key.GetComponent <Key>();
        thisExit  = exit.GetComponent <Exit>();
        thisLevel = level.GetComponent <LevelMaker>();
        thisTimer = timer.GetComponent <TimeManager>();
        ResetIndexValues();
        ResetLocations();
        levelCount = 1;
        DisplayLevel();
        thisTimer.ResetTimer();
    }
Beispiel #9
0
 void OnEnable()
 {
     lvlmakerobject                 = new SerializedObject(target);
     lvlmaker                       = (LevelMaker)target;
     headingStyle.fontStyle         = FontStyle.Bold;
     headingStyle.normal.textColor  = new Color(0.129f, 0.588f, 0.952f);
     headingStyle2.fontStyle        = FontStyle.Bold;
     headingStyle.fontSize          = 12;
     headingStyle2.normal.textColor = new Color(0.956f, 0.2627f, 0.2117f, 1);
     headingStyle2.fontSize         = 16;
     headingStyle3.normal.textColor = Color.magenta;
     headingStyle3.fontSize         = 12;
 }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     levelMaker = GameObject.FindGameObjectWithTag("GameManager").GetComponent <LevelMaker>();
     grid       = new GameObject[columns, rows];
     grid       = levelMaker.generatePieces(7, grid, columns, rows);
     GenerateNextPiece();
     SpawnNextPiece();
     moveDownTimer  = Time.time + normalMovDowneRate;
     debug          = GetComponent <Debug>();
     pauseMenu      = GameObject.FindGameObjectWithTag("GameManager").GetComponent <PauseMenu>();
     gameOverScreen = GameObject.FindGameObjectWithTag("GameOverMenu");
     gameOverScore  = GameObject.FindGameObjectWithTag("GameOverScore").GetComponent <Text>();
     gameOverScreen.SetActive(false);
     LastMatches = new List <GameObject>();
 }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        EditorGUILayout.HelpBox(@"LEGEND
-----------------------------
B = Void wall
X = Ground
O = Block
U = Two Blocks", MessageType.Info);

        LevelMaker lvlMkr = (LevelMaker)target;

        if (GUILayout.Button("Load Scene"))
        {
            lvlMkr.LoadIn();
        }
    }
    public void PopulateObstacles()
    {
        try
        {
            //Grid.Clear();
            if (!lvlmaker)
            {
                lvlmaker = GameObject.FindGameObjectWithTag("LevelMaker").GetComponent <LevelMaker>();
            }

            PointData returnPoints = lvlmaker.PopulateLevel(pointset.Grid);
            LevelDesign.UpdatePoints(returnPoints.levelPoints);
            LevelDesign.seedobstacle();
            if (Obstacles)
            {
                Obstacles.UpdatePoints(returnPoints.obstaclePoints);
                Obstacles.seedobstacle();
            }
        }catch (System.Exception e)
        {
            Debug.LogError("Check Level Maker for empty PatternSet or Levels, check for unassigned variable in Level Populator! " + e.Data);
        }
    }
Beispiel #13
0
        public Game Create(Player player)
        {
            var levelMaker = new LevelMaker(player.Heroes);
            var levels     = new List <Level>
            {
                levelMaker
                .AddWaves(GetFirstLevelWaves())
                .MakeLevel(),
                levelMaker
                .AddWaves(GetSecondLevelWaves())
                .MakeLevel(),
                levelMaker
                .AddWaves(GetThirdLevelWaves())
                .MakeLevel(),
                levelMaker
                .AddWaves(GetFourthLevelWaves())
                .MakeLevel(),
                levelMaker
                .AddWaves(GetFifthLevelWaves())
                .MakeLevel()
            };

            return(new Game(levels, player));
        }
 void Start()
 {
     // Grid.Clear();
     // Grid = pointset.Grid;
     lvlmaker = GameObject.FindGameObjectWithTag("LevelMaker").GetComponent <LevelMaker>();
 }
Beispiel #15
0
 public void OnEnable()
 {
     grid = (LevelMaker)target;
 }
Beispiel #16
0
 public VictoryState()
 {
     levelMaker = new LevelMaker();
 }
 public void OnEnable()
 {
     grid = (LevelMaker)target;
 }
Beispiel #18
0
 void OnEnable()
 {
     LevelMakerScript = GetComponent <LevelMaker>();
 }