Пример #1
0
    void Start()
    {
        introHolder    = FindObjectOfType <StartGameID> ();
        tileController = FindObjectOfType <TileController>();
        tileController.Setup();
        buildingController = FindObjectOfType <BuildingController> ();
        buildingController.Setup();
        inGameDBController    = FindObjectOfType <InGameDBController>();
        orientationController = FindObjectOfType <OrientationController>();
        taskController        = FindObjectOfType <TaskController>();
        taskController.Setup();
        inGameDBController.StartConnection();
        inGameDBController.FetchInitialGridData();
        tileController.CreateGrid(inGameDBController.GetGridSize());
        inGameDBController.FetchBuildingData();
        buildingController.CreateBuildings(inGameDBController.GetBuildingData());
        inGameDBController.SetGameID(introHolder.GetRoomID());
        inGameDBController.InsertRoomData(introHolder.GetTurnID(), introHolder.getIGNList(), introHolder.getPIDList());
        inGameDBController.FetchCurrentPlayerTurn();
        localPlayerPID    = introHolder.GetPID();
        localPlayerTurnID = introHolder.GetTurnID();
        //GameObject.Destroy (introHolder);

        players = new List <Player>();
        Debug.Log(inGameDBController.GetNumberOfPlayers());
        CreatePlayers(inGameDBController.GetNumberOfPlayers());
        inGameDBController.FetchTaskData();
        taskController.AssignBuildingTasks(inGameDBController.GetTaskData(), buildingController.GetBuildings());
        taskController.AssignLocalPlayerTasks(inGameDBController.GetTaskData(), GetLocalPlayer());
        taskController.InitializeLPTaskLabels(GetLocalPlayer().tasks);

        orientationController.ScaleUI();
        tileController.SetLocalPlayerModelRef(players[localPlayerTurnID].playerModel);

        SetInitialCameraPosition();
        remainingMoves = 0;
        turnHasBegun   = false;
        orientationController.SetMovesLabel("Wait Your Turn");
        orientationController.SetRollDiceButtonStatus(false);
        orientationController.SetEnterBuildingButtonStatus(false);
        orientationController.SetEndTurnButtonStatus(false);
        tileController.SetCanLightUpTile(false);

        if (GetIsLocalPlayerTurn())
        {
            BeginTurn();
        }

        timer = 0;
    }