Exemple #1
0
        private void Awake()
        {
            _generatorModel = new GeneratorModel();
            _generatorModel.SetPrefabs();

            _generatorView.GeneratorModel = _generatorModel;
            _generatorView.BoxModel       = _boxController.GetModel();

            _generatorView.OnStoreInstantiatedBox = OnStoreInstantiatedBox;

            _groundHeight = 0.7f;
            _boxHeight    = 0.5f;

            _generatorView.OnAddHeightOfPosition = () =>
            {
                AddHeightPositon();
            };

            _generatorView.OnSetStarterBox = (starterBox, pieces) =>
            {
                _generatorModel.StarterBox = starterBox;
                _boxController.GetModel().BoxPieces = pieces;
            };

            _generatorView.StarterParent   = GameObject.Find("environment").transform;
            _generatorView.GeneratorParent = GameObject.Find("Generator").transform;
            _generatorView.PiecesParent    = GameObject.Find("Pieces").transform;

            _generatorView.GenerateStarter();
            _generatorView.GenerateBoxes();
        }
Exemple #2
0
        private void OnEnable()
        {
            _activatorModel = new ActivatorModel();

            _activatorView.ActivatorModel = _activatorModel;
            _activatorView.BoxModel       = _boxController.GetModel();
            _activatorView.GeneratorModel = _generatorController.GetModel();
            _activatorView.MovementModel  = _movementController.GetModel();


            #region Activator View Callback

            _activatorView.OnAddHeigtOfPosition = () =>
            {
                _generatorController.AddHeightPositon();
            };

            _activatorView.OnAddDeactiveBoxIndex = () =>
            {
                if (!_activatorModel.isReadytoDeactived)
                {
                    _activatorModel.isReadytoDeactived = true;
                }

                if (_activatorModel.IndexBoxDeactivated == _boxController.GetModel().ListOfBox.Count - 1)
                {
                    _activatorModel.IndexBoxDeactivated = 0;
                }
                else
                {
                    _activatorModel.IndexBoxDeactivated++;
                }
            };

            _activatorView.OnBoxActived = () =>
            {
                _activatorModel.isReadyForNewBox = false;
            };

            #endregion
            #region Movement Controller Callback

            _movementController.OnAddNewBox = () =>
            {
                if (_activatorModel.CurrentActiveBox == _boxController.GetModel().ListOfBox.Count - 1)
                {
                    _activatorModel.CurrentActiveBox = 0;
                }
                else
                {
                    _activatorModel.CurrentActiveBox++;
                }
                _activatorModel.isReadyForNewBox = true;
            };

            #endregion
        }
Exemple #3
0
        // Start is called before the first frame update
        void Start()
        {
            _cutTheBoxModel = new CutTheBoxModel();
            _cutTheBoxView.CutTheBoxModel = _cutTheBoxModel;

            _cutTheBoxView.BoxModel       = _boxController.GetModel();
            _cutTheBoxView.ActivatorModel = _activatorController.GetModel();
            _cutTheBoxView.MovementModel  = _movementController.GetModel();

            _calculateScaleController.OnFinishCalculate = (newScale, newPosition, pieceScale, piecePosition) =>
            {
                //Debug.Log(pieceScale + " " + piecePosition);
                _cutTheBoxModel.SetNewBoxScale(newScale);
                _cutTheBoxModel.SetNewBoxPosition(newPosition);
                _cutTheBoxModel.SetPieceScale(pieceScale);
                _cutTheBoxModel.SetPiecesPosition(piecePosition);
            };

            _calculateScaleController.OnCutTheBox = () =>
            {
                _cutTheBoxView.RescaleTheBox();
                _cutTheBoxView.CenterUpTheBox();
                OnAddScore();
                _scoreController.OnUpdateScoreText();
                _piecesController.OnActivatedPieces();
            };
        }
Exemple #4
0
        // Start is called before the first frame update
        void Start()
        {
            _movementView.MovementModel  = _movementModel;
            _movementView.BoxModel       = _boxController.GetModel();
            _movementView.ActivatorModel = _activatorController.GetModel();

            _movementView.OnChangeCurrentPoint = () =>
            {
                ChangeCurrentPointPosition();
            };

            _movementView.OnMoveBoxDown = () =>
            {
                MoveBoxDown();
            };
        }
        private void Start()
        {
            _scoreView.BoxModel = _boxController.GetModel();

            OnUpdateScoreText = () =>
            {
                _scoreView.SetScoreToText();
            };
        }
        private void Start()
        {
            _boxPiecesView.CutTheBoxModel = _cutTheBoxController.GetModel();
            _boxPiecesView.BoxModel       = _boxController.GetModel();
            _boxPiecesView.ActivatorModel = _activatorController.GetModel();
            _boxPiecesView.MovementModel  = _movementController.GetModel();

            OnActivatedPieces = () =>
            {
                _boxPiecesView.InstantiateNewPieces();
            };
        }
Exemple #7
0
        private void Start()
        {
            _calculateScaleView.BoxModel       = _boxController.GetModel();
            _calculateScaleView.ActivatorModel = _activatorController.GetModel();
            _calculateScaleView.MovementModel  = _movementController.GetModel();

            _calculateScaleView.OnReadyToCalculate = () =>
            {
                CalculateScale();
            };

            _calculateScaleView.OnGameover = () =>
            {
                _boxController.GameIsOver();
            };

            _movementController.OnCalculate = () =>
            {
                _calculateScaleView.CheckingPositon();
            };
        }