private MainField InstantiateMainField(IMatrix <IMainFieldSquare> mainMatrix, MovingSquare movingSquare) { var mainField = Instantiate(_mainFieldPrefub, gameObject.transform); mainField.Matrix = mainMatrix; mainField.MovingSquare = movingSquare; mainField.transform.position = new Vector3( -HalfFieldSize * BrickSetting.TileSize + Offset, -HalfFieldSize * BrickSetting.TileSize + Offset, 0); return(mainField); }
public Scene(FieldSetting setting) { _matrixField = MainField.Create(setting); _sideFields = new Dictionary <Side, SideField> { [Side.Top] = SideField.Create(setting, Side.Top), [Side.Left] = SideField.Create(setting, Side.Left), [Side.Bottom] = SideField.Create(setting, Side.Bottom), [Side.Right] = SideField.Create(setting, Side.Right) }; _movingSquare = new MovingSquare(); _movingSquare.StateChanged += HandleMovingSquareStateChangedEvent; _score = new Score(setting); _score.ScoreUpdated += HandleScoreUpdatedEvent; _stateManagers = new List <IStateManager>(); InitStateManagersList(); }