Exemple #1
0
    /// <summary>
    /// demo screen to list some included example scripts
    /// </summary>
    private void DemoIntro()
    {
        if (m_Demo.FirstFrame)
        {
            m_Demo.FirstFrame    = false;
            m_Demo.DrawCrosshair = false;
            m_Demo.FreezePlayer(m_OverviewPos, m_OverviewAngle, true);
            m_Demo.Input.ForceCursor = true;
        }

        m_Demo.DrawBoxes("welcome", "Featuring the SMOOTHEST CONTROLS and the most POWERFUL FPS CAMERA\navailable for Unity, Ultimate FPS is an awesome script pack for achieving that special\n 'AAA FPS' feeling. This demo will walk you through some of its core features ...\n", null, ImageRightArrow, null, null);
        m_Demo.ForceCameraShake();
    }
Exemple #2
0
    ///////////////////////////////////////////////////////////
    // demo screen to explain preset loading and saving features
    ///////////////////////////////////////////////////////////
    private void DemoPreset()
    {
        if (m_Demo.FirstFrame)
        {
            m_Demo.FirstFrame    = false;
            m_Demo.DrawCrosshair = false;
            m_Demo.FreezePlayer(m_OverviewPos, m_OverviewAngle, true);
            m_Player.SetWeapon(0);
        }

        m_Demo.DrawBoxes("presets & states", "Perhaps our most powerful feature is the COMPONENT PRESET SYSTEM, which allows you to save component snapshots in text files. The new advanced STATE MANAGER then blends between your presets at runtime. This allows for very complex preset combinations with smooth, natural transitions (and little or no need for scripting).", null, ImageRightArrow);
        m_Demo.DrawImage(ImagePresetDialogs);

        m_Demo.ForceCameraShake();
    }
Exemple #3
0
    /// <summary>
    /// demo screen to show a welcoming message
    /// </summary>
    private void DemoIntro()
    {
        // draw the three big boxes at the top of the screen;
        // the next & prev arrows, and the main text box
        m_Demo.DrawBoxes("part ii: under the hood", "Ultimate FPS features a NEXT-GEN first person camera system with ultra smooth PROCEDURAL ANIMATION of player movements. Camera and weapons are manipulated using over 100 parameters, allowing for a vast range of super-lifelike behaviors.", null, m_ImageRightArrow);

        // this bracket is only run the first frame of a new demo screen
        // being rendered. it is used to make some initial settings
        // specific to the current demo screen.
        if (m_Demo.FirstFrame)
        {
            m_Demo.DrawCrosshair = false;
            m_Demo.FirstFrame    = false;
            m_Demo.Camera.RenderingFieldOfView = 20;
            m_Demo.Camera.SnapZoom();
            m_Demo.WeaponHandler.SetWeapon(0);
            m_Demo.FreezePlayer(m_OverviewPos, m_OverviewAngle, true);                                  // prevent player from moving
            m_Demo.LastInputTime -= 20;                                                                 // makes the big arrow start fading 20 seconds earlier on this screen
            m_Demo.RefreshDefaultState();
            m_Demo.Input.MouseCursorForced = true;
        }

        m_Demo.Input.MouseCursorForced = true;
        m_Demo.ForceCameraShake();
    }
Exemple #4
0
    /// <summary>
    /// demo screen to list some included example scripts
    /// </summary>
    private void DemoIntro()
    {
        if (m_Demo.FirstFrame)
        {
            m_Demo.FirstFrame    = false;
            m_Demo.DrawCrosshair = false;
            m_Demo.FreezePlayer(m_OverviewPos, m_OverviewAngle, true);
            m_Demo.Input.MouseCursorForced = true;

            m_BodyAnimator = (vp_BodyAnimator)Component.FindObjectOfType(typeof(vp_BodyAnimator));
            if (m_BodyAnimator != null)
            {
                m_BodyAnimator.gameObject.SetActive(false);
            }
        }

        m_Demo.DrawBoxes("welcome", "Featuring the SMOOTHEST CONTROLS and the most POWERFUL FPS CAMERA\navailable for Unity, UFPS is an awesome script pack for achieving that special\n 'AAA FPS' feeling. This demo will walk you through some of its core features ...\n", null, ImageRightArrow, null, null);
        m_Demo.ForceCameraShake();
    }
Exemple #5
0
    /// <summary>
    ///
    /// </summary>
    void DemoPhysics()
    {
        m_Demo.DrawBoxes("part iii: physics", "Ultimate FPS features a cool, tweakable MOTOR and PHYSICS simulation.\nAll motion is forwarded to the camera and weapon for some CRAZY MOVES that you won't see in an everyday FPS. Click these buttons for some quick examples ...", null, ImageRightArrow);
        if (m_Demo.FirstFrame)
        {
            m_Demo.DrawCrosshair = true;
            m_Demo.Teleport(m_SlimePos, m_SlimeAngle);                                                          // place the player at start point
            m_Demo.FirstFrame      = false;
            m_Demo.ButtonSelection = 0;
            m_Demo.Camera.SnapSprings();
            m_Demo.RefreshDefaultState();
            m_Demo.Input.ForceCursor = true;
            m_Demo.Teleport(m_SlimePos, m_SlimeAngle);
            m_Demo.WeaponHandler.SetWeapon(1);
            m_ExamplesCurrentSel = -1;
            m_RunForward         = false;
            m_LookPoint          = 0;
            m_Demo.LockControls();
        }

        // 'go again' button
        if (m_Demo.ShowGUI && !m_GoAgainTimer.Active && m_Demo.ButtonSelection != 3)
        {
            GUI.color            = new Color(1, 1, 1, m_GoAgainButtonAlpha);
            m_GoAgainButtonAlpha = Mathf.Lerp(0, 1, m_GoAgainButtonAlpha + (Time.deltaTime));
            if (GUI.Button(new Rect((Screen.width / 2) - 60, 210, 120, 30), "Go again!"))
            {
                m_GoAgainButtonAlpha = 0.0f;
                m_ExamplesCurrentSel = -1;
            }
            GUI.color = new Color(1, 1, 1, 1 * m_Demo.GlobalAlpha);
        }

        // toggle examples using the buttons
        if (m_Demo.ButtonSelection != m_ExamplesCurrentSel)
        {
            m_WASDInfoClickTime = Time.time;
            m_Demo.Controller.Stop();
            m_Jump               = false;
            m_LookPoint          = 0;
            m_GoAgainButtonAlpha = 0.0f;
            m_ForceTimer.Cancel();
            m_Demo.Controller.Stop();
            m_Demo.PlayerEventHandler.RefreshActivityStates();
            m_Demo.Input.ForceCursor = true;

            // reset some values to default on the controller
            m_Demo.Controller.PhysicsSlopeSlidiness = 0.15f;
            m_Demo.Controller.MotorAirSpeed         = 0.7f;
            m_Demo.Controller.MotorAcceleration     = 0.18f;
            m_Demo.Controller.PhysicsWallBounce     = 0.0f;

            // cancel all example timers
            m_HeadBumpTimer1.Cancel();
            m_HeadBumpTimer2.Cancel();
            m_ActionTimer1.Cancel();
            m_ActionTimer2.Cancel();
            m_ActionTimer3.Cancel();
            m_ActionTimer4.Cancel();
            m_ActionTimer5.Cancel();
            m_GoAgainTimer.Cancel();
            m_ForceTimer.Cancel();

            Screen.lockCursor = true;

            m_Demo.Camera.SnapSprings();

            if (m_Demo.WeaponHandler.CurrentWeapon != null)
            {
                m_Demo.Camera.SnapSprings();
            }

            m_Demo.PlayerEventHandler.Platform.Set(null);

            switch (m_Demo.ButtonSelection)
            {
            case 0:
                vp_Timer.In(29, delegate() { }, m_GoAgainTimer);
                m_Demo.Teleport(m_SlimePos, m_SlimeAngle);
                break;

            case 1:
                vp_Timer.In(5, delegate()
                {
                }, m_GoAgainTimer);
                m_Demo.Teleport(m_WetRoofPos, m_WetRoofAngle);
                m_Demo.Controller.PhysicsSlopeSlidiness = 1.0f;
                break;

            case 2:
                m_Demo.Controller.MotorAirSpeed = 0.0f;
                m_Demo.Teleport(m_ActionPos, m_ActionAngle);
                m_Demo.SnapLookAt(m_LookPoints[1]);
                m_LookPoint  = 1;
                m_RunForward = true;
                vp_Timer.In(1.75f, delegate() { m_LookPoint = 2; m_Jump = true; m_Demo.LookDamping = 1.0f; }, m_ActionTimer1);
                vp_Timer.In(2.25f, delegate() { m_LookPoint = 3; m_Jump = false; m_Demo.LookDamping = 1.0f; }, m_ActionTimer2);
                vp_Timer.In(3.5f, delegate() { m_LookPoint = 4; m_Demo.Controller.MotorAcceleration = 0.0f; m_Demo.LookDamping = 3.0f; }, m_ActionTimer3);
                vp_Timer.In(5.0f, delegate() { m_LookPoint = 5; m_RunForward = false; m_Demo.Controller.MotorAcceleration = 0.18f; m_Demo.LookDamping = 1.0f; }, m_ActionTimer4);
                vp_Timer.In(9.0f, delegate() { m_LookPoint = 8; }, m_ActionTimer5);
                vp_Timer.In(11, delegate() { }, m_GoAgainTimer);
                break;

            case 4:
                m_Demo.Teleport(m_HeadBumpPos, m_HeadBumpAngle);
                vp_Timer.In(1.0f, delegate() { m_Jump = true; }, m_HeadBumpTimer1);
                vp_Timer.In(1.25f, delegate() { m_Jump = false; }, m_HeadBumpTimer2);
                vp_Timer.In(2, delegate() { }, m_GoAgainTimer);
                break;

            case 5:
                m_Demo.Teleport(m_WallBouncePos, m_WallBounceAngle);
                m_LookPoint        = 6;
                m_Demo.LookDamping = 0;
                vp_Timer.In(1, delegate()
                {
                    m_LookPoint        = 7;
                    m_Demo.LookDamping = 3;
                    m_Demo.Controller.PhysicsWallBounce = 0.0f;
                    GameObject.Instantiate(m_ExplosionFX, m_Demo.Controller.transform.position + new Vector3(3, 0, 0), Quaternion.identity);
                    m_Demo.PlayerEventHandler.BombShake.Send(0.3f);
                    m_Demo.Controller.AddForce(Vector3.right * 3.0f);
                    if (m_Demo.WeaponHandler.CurrentWeapon != null)
                    {
                        m_Demo.WeaponHandler.CurrentWeapon.audio.PlayOneShot(m_ExplosionSound);
                    }
                }, m_ForceTimer);
                vp_Timer.In(5, delegate()
                {
                    m_Demo.Controller.PhysicsWallBounce = 0.0f;
                    m_LookPoint        = 6;
                    m_Demo.LookDamping = 0.5f;
                    m_Demo.Teleport(m_WallBouncePos, m_WallBounceAngle);
                }, m_GoAgainTimer);
                break;

            case 6:
                vp_Timer.In(5, delegate() { }, m_GoAgainTimer);
                m_Demo.Teleport(m_FallDeflectPos, m_FallDeflectAngle);
                break;

            case 7:
                vp_Timer.In(7, delegate() { }, m_GoAgainTimer);
                vp_Timer.In(1, delegate()
                {
                    GameObject.Instantiate(m_ExplosionFX, m_Demo.Controller.transform.position + new Vector3(-3, 0, 0), Quaternion.identity);
                    m_Demo.PlayerEventHandler.BombShake.Send(0.5f);
                    m_Demo.Controller.AddForce(Vector3.forward * 0.55f);
                    if (m_Demo.WeaponHandler.CurrentWeapon != null)
                    {
                        m_Demo.WeaponHandler.CurrentWeapon.audio.PlayOneShot(m_ExplosionSound);
                    }
                }, m_ForceTimer);
                m_Demo.Teleport(m_BlownAwayPos, m_BlownAwayAngle);
                break;

            case 3:
                m_Demo.Input.ForceCursor = false;
                m_Demo.WeaponHandler.SetWeapon(2);
                m_Demo.Teleport(m_ExplorePos, m_ExploreAngle);
                m_Demo.Input.AllowGameplayInput = true;
                break;
            }

            m_Demo.LastInputTime = Time.time;
            m_ExamplesCurrentSel = m_Demo.ButtonSelection;
        }

        // some special cases to be run every frame

        if (m_Demo.ButtonSelection != 2 && m_Demo.ButtonSelection != 3)
        {
            m_Demo.LockControls();
            m_Demo.Input.AllowGameplayInput = false;
        }
        else if (m_Demo.ButtonSelection != 3)
        {
            m_Demo.LockControls();
            m_Demo.Input.AllowGameplayInput = false;
        }

        if (m_Demo.ButtonSelection != 3 && m_Demo.WeaponHandler.CurrentWeaponID != 1)
        {
            m_Demo.WeaponHandler.SetWeapon(1);
        }

        switch (m_Demo.ButtonSelection)
        {
        case 0:
            // force this camera angle since it has a tendency to get
            // altered by buffered mouse input during loading
            m_Demo.Camera.Angle = m_SlimeAngle;
            break;

        case 2:
            Vector2 input = m_Demo.PlayerEventHandler.InputMoveVector.Get();
            input.y = m_RunForward ? 1.0f : 0.0f;
            m_Demo.PlayerEventHandler.InputMoveVector.Set(input);
            m_Demo.PlayerEventHandler.Jump.Active = m_Jump;
            if (m_Demo.Controller.StateEnabled("Run") != m_RunForward)
            {
                m_Demo.Controller.SetState("Run", m_RunForward, true);
            }
            m_Demo.SmoothLookAt(m_LookPoints[m_LookPoint]);
            break;

        case 4:
            m_Demo.PlayerEventHandler.Jump.Active = m_Jump;
            break;

        case 5:
            m_Demo.SmoothLookAt(m_LookPoints[m_LookPoint]);
            break;

        case 3:
            // draw menu re-enable text
            if (m_Demo.ShowGUI && Screen.lockCursor)
            {
                GUI.color = new Color(1, 1, 1, ((m_Demo.ClosingDown) ? m_Demo.GlobalAlpha : 1.0f));
                GUI.Label(new Rect((Screen.width / 2) - 200, 140, 400, 20), "(Press ENTER to reenable menu)", m_Demo.CenterStyle);
                GUI.color = new Color(0, 0, 0, 1 * (1.0f - ((Time.time - m_WASDInfoClickTime) * 0.05f)));
                GUI.Label(new Rect((Screen.width / 2) - 200, 170, 400, 20), "(Use WASD to move around freely)", m_Demo.CenterStyle);
                GUI.color = new Color(1, 1, 1, 1 * m_Demo.GlobalAlpha);
            }
            break;
        }

        // show a toggle column, a compound control displaying a
        // column of buttons that can be toggled like radio buttons
        if (m_Demo.ShowGUI)
        {
            m_ExamplesCurrentSel = m_Demo.ButtonSelection;
            string[] strings = new string[] { "Mud... or Slime", "Wet Roof", "Action Hero", "Moving Platforms", "Head Bumps", "Wall Deflection", "Fall Deflection", "Blown Away" }; m_Demo.ButtonSelection = m_Demo.ToggleColumn(140, 150, m_Demo.ButtonSelection, strings, false, true, ImageRightPointer, ImageLeftPointer);
        }
    }