Ejemplo n.º 1
0
    public tnCamerasSet GetData(int i_Id)
    {
        tnCamerasSet data = null;

        m_Data.TryGetValue(i_Id, out data);
        return(data);
    }
Ejemplo n.º 2
0
    // LOGIC

    public void Initialize(string i_DatabasePath)
    {
        tnCamerasDatabase database = Resources.Load <tnCamerasDatabase>(i_DatabasePath);

        if (database != null)
        {
            foreach (string id in database.keys)
            {
                tnCameraSetDescriptor cameraSetDescriptor = database.GetCameraSet(id);
                if (cameraSetDescriptor != null)
                {
                    int hash = StringUtils.GetHashCode(id);

                    tnCamerasSet cameraSet = new tnCamerasSet(cameraSetDescriptor);
                    m_Data.Add(hash, cameraSet);
                }
            }
        }
        else
        {
            LogManager.LogWarning(this, "Database not loaded.");
        }
    }
        public override void OnEnter()
        {
            tnMatchSettingsModule module = GameModulesManager.GetModuleMain <tnMatchSettingsModule>();

            if (module != null)
            {
                int            gameModeId   = module.gameModeId;
                tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(gameModeId);

                if (gameModeData != null)
                {
                    int          camerasSetId = gameModeData.camerasSetId;
                    tnCamerasSet camerasSet   = tnGameData.GetCameraSetMain(camerasSetId);

                    if (camerasSet != null)
                    {
                        int           stadiumId   = module.stadiumId;
                        tnStadiumData stadiumData = tnGameData.GetStadiumDataMain(stadiumId);

                        if (stadiumData != null)
                        {
                            GameObject cameraPrefab = camerasSet.GetCamera(stadiumData.cameraId);

                            if (cameraPrefab != null)
                            {
                                if (storeResult != null && !storeResult.IsNone)
                                {
                                    storeResult.Value = cameraPrefab.gameObject;
                                }
                            }
                        }
                    }
                }
            }

            Finish();
        }
Ejemplo n.º 4
0
    private void CreateCamera()
    {
        GameObject spawnPointGo = GameObject.Find(s_Camera_SpawnPoint_Name);

        Vector3 spawnPointPosition = (spawnPointGo != null) ? spawnPointGo.transform.position : Vector3.zero;

        spawnPointPosition.z = -15f;

        tnMatchSettingsModule matchSettingsModule = GameModulesManager.GetModuleMain <tnMatchSettingsModule>();

        if (matchSettingsModule == null)
        {
            return;
        }

        int            gameModeId   = matchSettingsModule.gameModeId;
        tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(gameModeId);

        if (gameModeData == null)
        {
            return;
        }

        int          cameraSetId = gameModeData.camerasSetId;
        tnCamerasSet cameraSet   = tnGameData.GetCameraSetMain(cameraSetId);

        if (cameraSet == null)
        {
            return;
        }

        int           stadiumId   = matchSettingsModule.stadiumId;
        tnStadiumData stadiumData = tnGameData.GetStadiumDataMain(stadiumId);

        if (stadiumData == null)
        {
            return;
        }

        GameObject cameraPrefab = cameraSet.GetCamera(stadiumData.cameraId);

        if (cameraPrefab == null)
        {
            return;
        }

        m_GameCameraGO      = Instantiate <GameObject>(cameraPrefab);
        m_GameCameraGO.name = "GameCamera";
        m_GameCameraGO.tag  = "GameCamera";

        tnGameCamera gameCamera = m_GameCameraGO.GetComponent <tnGameCamera>();

        if (gameCamera != null)
        {
            gameCamera.SetPosition(spawnPointPosition);
        }
        else
        {
            m_GameCameraGO.transform.position = spawnPointPosition;
        }

        m_GameCameraGO.transform.rotation = Quaternion.identity;
    }