static int MoveToTopOfPrioritySubqueue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Cinemachine.CinemachineVirtualCameraBase obj = (Cinemachine.CinemachineVirtualCameraBase)ToLua.CheckObject <Cinemachine.CinemachineVirtualCameraBase>(L, 1);
         obj.MoveToTopOfPrioritySubqueue();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#2
0
        private void Update()
        {
            ValidateCache();

            // Is there a minimum activation tme to respect?
            float now = Time.time;

            if (mActivationTime == 0 || mActiveInstruction == null ||
                now >= mActivationTime + mActiveInstruction.m_MinDuration)
            {
                // Did we get an event?
                if (mPendingActivationTime != 0 && mPendingInstruction != null &&
                    mPendingActivationTime <= now)
                {
                    DeactivateCurrentInstruction();

                    mActivationTime    = now;
                    mActiveInstruction = mPendingInstruction;

                    mPendingInstruction    = null;
                    mPendingActivationTime = 0;

                    CinemachineVirtualCameraBase vcam = mActiveInstruction.m_VirtualCamera;
                    if (vcam != null)
                    {
                        if (!vcam.gameObject.activeSelf)
                        {
                            mWasDisabled = true;
                            vcam.gameObject.SetActive(true);
                        }
                        if (mActiveInstruction.m_PriorityBoost != 0)
                        {
                            mActiveInstruction.m_VirtualCamera.Priority += mActiveInstruction.m_PriorityBoost;
                        }
                        else
                        {
                            vcam.MoveToTopOfPrioritySubqueue();
                        }
                    }
                }
            }
            // Has the current instruction expired?
            if (mActiveInstruction != null && mActiveInstruction.m_MaxDuration > 0 &&
                (now - mActivationTime) > mActiveInstruction.m_MaxDuration)
            {
                DeactivateCurrentInstruction();
            }
        }
示例#3
0
            /// <summary>Invoke the action.  Depending on the mode, different action will
            /// be performed.  The embedded event will always be invoked, in addition to the
            /// action specified by the Mode.</summary>
            public void Invoke()
            {
                UnityEngine.Object currentTarget = m_Target;
                if (currentTarget != null)
                {
                    GameObject targetGameObject = currentTarget as GameObject;
                    Behaviour  targetBehaviour  = currentTarget as Behaviour;
                    if (targetBehaviour != null)
                    {
                        targetGameObject = targetBehaviour.gameObject;
                    }

                    switch (m_Action)
                    {
                    case Mode.Custom:
                        break;

                    case Mode.PriorityBoost:
                    {
                        CinemachineVirtualCameraBase vcam
                            = targetGameObject.GetComponent <CinemachineVirtualCameraBase>();
                        if (vcam != null)
                        {
                            vcam.Priority += m_BoostAmount;
                            vcam.MoveToTopOfPrioritySubqueue();
                        }
                        break;
                    }

                    case Mode.Activate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.SetActive(true);
                            CinemachineVirtualCameraBase vcam
                                = targetGameObject.GetComponent <CinemachineVirtualCameraBase>();
                            if (vcam != null)
                            {
                                vcam.MoveToTopOfPrioritySubqueue();
                            }
                        }
                        break;

                    case Mode.Deactivate:
                        if (targetGameObject != null)
                        {
                            targetGameObject.SetActive(false);
                        }
                        break;

                    case Mode.Enable:
                    {
                        if (targetBehaviour != null)
                        {
                            targetBehaviour.enabled = true;
                        }
                        break;
                    }

                    case Mode.Disable:
                    {
                        if (targetBehaviour != null)
                        {
                            targetBehaviour.enabled = false;
                        }
                        break;
                    }

                    case Mode.Play:
                    {
                        PlayableDirector playable
                            = targetGameObject.GetComponent <PlayableDirector>();
                        if (playable != null)
                        {
                            double startTime = 0;
                            double duration  = playable.duration;
                            double current   = playable.time;
                            switch (m_Mode)
                            {
                            default:
                            case TimeMode.FromStart:
                                startTime += m_StartTime;
                                break;

                            case TimeMode.FromEnd:
                                startTime = duration - m_StartTime;
                                break;

                            case TimeMode.BeforeNow:
                                startTime = current - m_StartTime;
                                break;

                            case TimeMode.AfterNow:
                                startTime = current + m_StartTime;
                                break;
                            }
                            playable.time = startTime;
                            playable.Play();
                        }
                        else
                        {
                            Animation ani = targetGameObject.GetComponent <Animation>();
                            if (ani != null)
                            {
                                ani.Play();
                            }
                        }
                        break;
                    }

                    case Mode.Stop:
                    {
                        PlayableDirector playable
                            = targetGameObject.GetComponent <PlayableDirector>();
                        if (playable != null)
                        {
                            playable.Stop();
                        }
                        else
                        {
                            Animation ani = targetGameObject.GetComponent <Animation>();
                            if (ani != null)
                            {
                                ani.Stop();
                            }
                        }
                        break;
                    }
                    }
                }
                m_Event.Invoke();
            }