Beispiel #1
0
    // ----------------------------------------------------------------
    //  Initialize
    // ----------------------------------------------------------------
    public void Initialize(Level _levelRef, Board _myBoard, RectTransform rt_availableArea)
    {
        this.MyLevel = _levelRef;
        this.MyBoard = _myBoard;
        GameUtils.ParentAndReset(this.gameObject, MyLevel.transform);

        // Determine unitSize and other board-specific visual stuff
        UpdatePosAndSize(rt_availableArea);

        // Add Player and Spaces!
        BeamRendererColliderArena = GetComponent <BeamRendererColliderArena>();
        BeamRendererColliderArena.Initialize(MyBoard, myRectTransform.rect);
        //Temp_PlayerView = AddObjectView(MyBoard.player) as PlayerView;
        spaceViews = new BoardSpaceView[NumCols, NumRows];
        for (int i = 0; i < NumCols; i++)
        {
            for (int j = 0; j < NumRows; j++)
            {
                spaceViews[i, j] = Instantiate(resourcesHandler.BoardSpaceView).GetComponent <BoardSpaceView>();
                spaceViews[i, j].Initialize(this, MyBoard.GetSpace(i, j));
            }
        }
        // Add all other views, and look right right away!
        UpdateViewsPostMove();

        // Add event listeners!
        GameManagers.Instance.EventManager.BoardExecutedMoveEvent += OnBoardExecutedMove;
    }