Пример #1
0
    public void Setup(int id, MinigameDisplayComponent displayComponent, Rect rect, int playerID, Action <MinigameTickResult> callback = null)
    {
        m_MiniGameID       = id;
        m_DisplayComponent = displayComponent;
        m_PlayerID         = playerID;
        m_GamePlayRect     = rect;
        FinishCallback     = callback;

        GameObject cameraObject = new GameObject("Minigame Camera");

        cameraObject.transform.localRotation = Quaternion.Euler(90, 0, 0);
        m_MinigameCamera = cameraObject.AddComponent <Camera>();
        m_MinigameCamera.transform.position = new Vector3(rect.center.x, 5.0f, rect.center.y);
        m_MinigameCamera.orthographic       = true;
        m_MinigameCamera.aspect             = rect.size.x / rect.size.y;
        m_MinigameCamera.orthographicSize   = rect.size.x / 2.0f;

        m_RenderTexture = new RenderTexture((int)rect.size.x * 64, (int)rect.size.y * 64, 24, RenderTextureFormat.Default);
        m_MinigameCamera.targetTexture = m_RenderTexture;
        m_DisplayComponent.SetRenderTexture(m_RenderTexture);
    }
Пример #2
0
    ////////////////////////////////////////////////////////////////

    public void CleanUp(MinigameTickResult result)
    {
        GameObject.Destroy(m_MinigameCamera.gameObject);
        m_DisplayComponent.SetRenderTexture(null);
        m_DisplayComponent.ReactToMinigameResult(result);
    }