コード例 #1
0
    void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (_cSyncedVar == m_cActiveTurretViewId)
        {
            if (m_cActiveTurretViewId.Get() != null)
            {
                CTurretBehaviour tb = m_cActiveTurretViewId.Get().GameObject.GetComponent <CTurretBehaviour>();

                // Register the handling cockpit rotations
                tb.EventTurretRotated += HandleCockpitRotations;

                // Set initial states
                HandleCockpitRotations(tb.TurretRotations, tb.MinMaxRotationX);

                // Set the render texture from the turret
                m_CockpitScreen.renderer.material.SetTexture("_MainTex", tb.CameraRenderTexture);
                m_CockpitScreen2.renderer.material.SetTexture("_MainTex", tb.CameraRenderTexture);
            }

            // Unregister previous the handling cockpit rotations
            if (m_cActiveTurretViewId.GetPrevious() != null)
            {
                m_cActiveTurretViewId.GetPrevious().GameObject.GetComponent <CTurretBehaviour>().EventTurretRotated -= HandleCockpitRotations;
            }
        }
    }
コード例 #2
0
ファイル: CTurretBehaviour.cs プロジェクト: dacuster/VOID
    void OnNetworkVarSync(INetworkVar _cSyncedVar)
    {
        if (_cSyncedVar == m_tRotation)
        {
            // Update the rotation of the turret
            transform.localEulerAngles           = new Vector3(0.0f, m_tRotation.Get().y, 0.0f);
            m_cBarrel.transform.localEulerAngles = new Vector3(m_tRotation.Get().x, 0.0f, 0.0f);

            if (EventTurretRotated != null)
            {
                EventTurretRotated(m_tRotation.Get(), MinMaxRotationX);
            }
        }
        else if (_cSyncedVar == m_ulControllerPlayerId)
        {
            if (ControllerPlayerId != 0)
            {
                // Enable the cameras
                m_ShipCamera.camera.enabled   = true;
                m_GalaxyCamera.camera.enabled = true;
            }
            else
            {
                // Disable the cameras
                m_ShipCamera.camera.enabled   = false;
                m_GalaxyCamera.camera.enabled = false;
            }

            if (EventControllerChange != null)
            {
                EventControllerChange(m_ulControllerPlayerId.GetPrevious(), m_ulControllerPlayerId.Get());
            }
        }
    }
コード例 #3
0
ファイル: CDUIRoot2D.cs プロジェクト: dacuster/VOID
    private void UpdatePanels()
    {
        if (m_ActivePanelId.GetPrevious() != null)
        {
            // Register the transition out handler
            CDUIPanel panel = PreviouslyActivePanel.GetComponent <CDUIPanel>();
            panel.EventTransitionOutFinished += PanelFinisehdTranstionOut;

            // Unregister the transition in handler just incase
            panel.EventTransitionInFinished -= PanelFinishedTranstionIn;

            // Transition this panel out
            panel.TransitionOut();
        }
        else
        {
            // Set active and transition the current panel in
            ActivePanel.SetActive(true);
            CDUIPanel panel = ActivePanel.GetComponent <CDUIPanel>();
            panel.TransitionIn();
        }
    }