Ejemplo n.º 1
0
    public void CreateNewBrick()
    {
        CameraFollowController camFC = Camera.main.GetComponent <CameraFollowController>();

        if (camFC != null)
        {
            if (_gamePrefabs.BricksGO.Count > 0 && _gameConfig.BrickPool.Count > 0)
            {
                int newBrickID = _gameConfig.BrickPool[0];

                _currentBrick   = Instantiate(_gamePrefabs.BricksGO[newBrickID], _gameConfig.connComp.BricksParentTR);
                _currentBrickRB = _currentBrick.GetComponent <Rigidbody>();
                _currentBrickM  = _currentBrick.GetComponent <BrickModel>();

                _currentBrick.transform.position = _gameConfig.BrickPos;
                _currentBrickRB.useGravity       = false;
                _currentBrickRB.detectCollisions = false;

                _currentBrickM.State             = BrickState.IDLE;
                _currentBrickM.EndTriggerTR      = _gameConfig.connComp.EndTriggerTR;
                _currentBrickM.OnEndTheGame     += _endTheGame;
                _currentBrickM.OnAddLockedBrick += _addLockedBrick;

                camFC.SetCameraTagetTR(_currentBrick.transform, _gameConfig.CameraOffset);

                _currentBrick.transform.RotateAround(Vector3.zero, Vector3.up, _gameConfig.BrickRot.y);

                _rotateBrick = true;

                _gameConfig.BrickPool.RemoveAt(0);
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        bestCreatureController = FindObjectOfType <BestCreaturesController>();
        cameraFollowController = FindObjectOfType <CameraFollowController>();
        evolution = FindObjectOfType <Evolution>();

        evolutionOverlayView.Delegate    = this;
        bestCreatureOverlayView.Delegate = this;
        sharedOverlayView.Delegate       = this;
        visibilityOptionsView.Delegate   = this;

        evolution.NewBatchDidBegin += delegate() {
            Refresh();
        };

        evolution.SimulationWasSaved += delegate() {
            sharedOverlayView.ShowSuccessfulSaveAlert();
        };

        bestCreatureController.PlaybackDidBegin += delegate() {
            Refresh();
        };

        evolution.InitializationDidEnd += delegate() {
            if (!Settings.DontShowV2SimulationDeprecationOverlayAgain &&
                evolution.SimulationData.LastV2SimulatedGeneration > 0)
            {
                v2PlaybackNoticePopup.Show();
            }
        };
    }
Ejemplo n.º 3
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
        }

        if (_instance == null)
        {
            _instance = this;
        }
    }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     _cameraFollow = Camera.main.GetComponent <CameraFollowController> ();
 }