Update() public method

public Update ( ) : float
return float
コード例 #1
0
        private static Vector3 GetMovementDirection()
        {
            float p = s_FPSTiming.Update();

            if (s_Motion.sqrMagnitude == 0f)
            {
                s_FlySpeed = 0f;
                return(Vector3.zero);
            }
            float num2 = !Event.current.shift ? ((float)1) : ((float)5);

            if (s_FlySpeed == 0f)
            {
                s_FlySpeed = 9f;
            }
            else
            {
                s_FlySpeed *= Mathf.Pow(1.8f, p);
            }
            return((Vector3)(((s_Motion.normalized * s_FlySpeed) * num2) * p));
        }
コード例 #2
0
        static Vector3 GetMovementDirection()
        {
            float deltaTime = s_FPSTiming.Update();

            if (s_Motion.sqrMagnitude == 0)
            {
                s_FlySpeed = 0;
                return(Vector3.zero);
            }
            else
            {
                float speed = Event.current.shift ? 5 : 1;
                if (s_FlySpeed == 0)
                {
                    s_FlySpeed = 9;
                }
                else
                {
                    s_FlySpeed = s_FlySpeed * Mathf.Pow(kFlyAcceleration, deltaTime);
                }
                return(s_Motion.normalized * s_FlySpeed * speed * deltaTime);
            }
        }
コード例 #3
0
        internal void PlayStopGUI()
        {
            if (s_Texts == null)
            {
                s_Texts = new Texts();
            }

            Event evt = Event.current;

            if (evt.type == EventType.Layout)
            {
                m_TimeHelper.Update();
            }

            bool       disablePlayButton = (Time.timeScale == 0.0f);
            GUIContent playText          = disablePlayButton ? s_Texts.playDisabled : s_Texts.play;

            if (!EditorApplication.isPlaying)
            {
                // Edit Mode: Play/Stop buttons
                GUILayout.BeginHorizontal(GUILayout.Width(210.0f));
                {
                    using (new EditorGUI.DisabledScope(disablePlayButton))
                    {
                        bool isPlaying = ParticleSystemEditorUtils.playbackIsPlaying && !ParticleSystemEditorUtils.playbackIsPaused && !disablePlayButton;
                        if (GUILayout.Button(isPlaying ? s_Texts.pause : playText, "ButtonLeft"))
                        {
                            if (isPlaying)
                            {
                                Pause();
                            }
                            else
                            {
                                Play();
                            }
                        }
                    }

                    if (GUILayout.Button(s_Texts.restart, "ButtonMid"))
                    {
                        Stop();
                        Play();
                    }

                    if (GUILayout.Button(s_Texts.stop, "ButtonRight"))
                    {
                        Stop();
                    }
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                // Play mode: we only handle play/stop (due to problems with determining if a system with subemitters is playing we cannot pause)
                GUILayout.BeginHorizontal();
                {
                    using (new EditorGUI.DisabledScope(disablePlayButton))
                    {
                        if (GUILayout.Button(playText))
                        {
                            Stop();
                            Play();
                        }
                    }
                    if (GUILayout.Button(s_Texts.stop))
                    {
                        Stop();
                    }
                }
                GUILayout.EndHorizontal();
            }

            // Playback info
            PlayBackInfoGUI(EditorApplication.isPlaying);

            // Handle shortcut keys last so we do not activate them if inputfield has used the event
            HandleKeyboardShortcuts();
        }