Exemplo n.º 1
0
        //unity

        private void BeginGame()
        {
            //create canyon
            canyon = GameObjectsFactory.getInstance().Create <Canyon>();
            canyon.Generate(difficulty);
            finishMarker = GameObjectsFactory.getInstance().Create <FinishMarker>();
            finishMarker.transform.position   = canyon.GetExitPoint();
            finishMarker.transform.localScale = new Vector3(20, 1, 0);
            finishMarker.onHitFinish         += OnHitFinish;

            //setup player if not yet
            if (player == null)
            {
                player = Instantiate(GameObjectsFactory.getInstance().playerPrefab);
                player.SetControl(control);
                player.SetPhysicsl(physics);
                player.SetPScore(score);
                cameraManager.SetTarget(player.gameObject);
            }

            RespawnPlayer();

            if (uiManager.isFirstStart)
            {
                uiManager.isFirstStart = false;
            }

            PlaySnowIfNeeded();

            isFinish         = false;
            Cursor.lockState = CursorLockMode.Locked;
        }