コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (GameplayConstants.isGameOver)
        {
            return;
        }

        if (gameMaker.CheckGameOver())
        {
            GameplayConstants.SetGameOver(true);
            return;
        }

        score.text = string.Format(" " + ++scoreCounter);

        if (!(Input.GetKey(KeyCode.Space)))
        {
            foreach (var o in world)
            {
                o.transform.position += Vector3.back * GameplayConstants.GameSpeedMultiplier;
            }
        }

        gameMaker.UpdateTheWorld();
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("init of GenerateBoxes.cs");

        //GameplayConstants should be a init class, where I should put all numbers and use the instance
        gameMaker = new GameMaker(GameplayConstants.rowCount,
                                  GameplayConstants.rowWidth,
                                  GameplayConstants.groundFrom,
                                  GameplayConstants.groundTo,
                                  Player,
                                  new SimpleLevelGenerator(),
                                  new SimpleGameRules(),
                                  new InfiniteWorldCreator());

        GameplayConstants.SetGameOver(false);

        gameMaker.LoadTheLevel();

        gameMaker.InitializeTheWorld();

        world = gameMaker.GetCreatedWorldObjects();
    }