示例#1
0
文件: GameMain.cs 项目: vthem/Tubular
    void Update()
    {
        if (landGenerator == null)
        {
            landGenerator = new LandGenerator(config);
        }
        landGenerator.Update();

        if (objectSpawner == null)
        {
            objectSpawner = new ObjectSpawner(config);
        }
        objectSpawner.Update();

        if (playerPhysics == null)
        {
            playerPhysics = new PlayerPhysics(playerObject, config);
        }
        playerPhysics.Update();

        if (cameraFollowPlayer == null)
        {
            cameraFollowPlayer = new CameraFollowPlayer(() => playerObject.transform, () => Camera.main.transform, config);
        }
        cameraFollowPlayer.Update();
    }
示例#2
0
    public void StartPlaying()
    {
        player         = GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity).GetComponent <Player>();
        currentState   = GameState.PLAYING;
        stateStartTime = Time.time;

        ShowPlayUI();

        followCamera.SetTarget(player.gameObject);
        followCamera.Update();
        enemySpawner.player = player;
        gameOver.SetActive(false);

        enemySpawner.Reset();
    }