Ejemplo n.º 1
0
    void InitLevel(string[] rows)
    {
        GameFieldModel fieldModel  = new GameFieldModel(rows);
        PlayerModel    playerModel = new PlayerModel(new FieldBounds(fieldModel.Width, fieldModel.Height),
                                                     TileUtility.GetTiles(TileType.Body, fieldModel.Tiles));

        GameFieldView fieldView  = gameField.GetComponent <GameFieldView> ();
        Player        playerView = player.GetComponent <Player> ();

        PlayerController    playerController    = new PlayerController(playerModel, playerView);
        GameFieldController gameFieldController = new GameFieldController(fieldModel, fieldView);

        LevelModel levelModel = new LevelModel();
        LevelView  levelView  = GetComponent <LevelView> ();

        StepTimer           tickTimer       = GetComponent <StepTimer> ();
        StepTimerController timerController = new StepTimerController(levelModel, playerView, tickTimer);

        StatusPanelView       statusView            = statusPanel.GetComponent <StatusPanelView> ();
        StatusPanelController statusPanelController = new StatusPanelController(levelModel, statusView);

        SpawnController spawnController = new SpawnController(fieldModel, playerModel);

        LevelController levelController = new LevelController(playerModel, fieldModel, levelModel, levelView, tickTimer);
    }
    public StatusPanelController(LevelModel levelModel, StatusPanelView statusView)
    {
        this.levelModel = levelModel;
        this.statusView = statusView;

        levelModel.ScoreChangedHandler        += UpdateScore;
        levelModel.PickedPointsChangedHandler += UpdatePicks;
    }