コード例 #1
0
ファイル: vp_FPSDemoManager.cs プロジェクト: Quint1212/AURORA
    /// <summary>
    /// sets a new default weapon preset. an optional shooter
    /// preset may be provided. if the optional 'smoothFade' bool
    /// is set to false, the new preset will snap in place.
    /// NOTE: this is just demo walkthrough code. manipulating
    /// the default state like this is no longer recommended.
    /// use additional states instead.
    /// </summary>
    public void SetWeaponPreset(TextAsset weaponPreset, TextAsset shooterPreset = null, bool smoothFade = true)
    {
        if (WeaponHandler.CurrentWeapon == null)
        {
            return;
        }

        WeaponHandler.CurrentWeapon.Load(weaponPreset);

        if (!smoothFade)
        {
            ((vp_FPWeapon)WeaponHandler.CurrentWeapon).SnapSprings();
            ((vp_FPWeapon)WeaponHandler.CurrentWeapon).SnapPivot();
            ((vp_FPWeapon)WeaponHandler.CurrentWeapon).SnapZoom();
        }

        WeaponHandler.CurrentWeapon.Refresh();

        if (shooterPreset != null)
        {
            if (CurrentShooter != null)
            {
                CurrentShooter.Load(shooterPreset);
            }
        }
        CurrentShooter.Refresh();
    }
コード例 #2
0
    ///////////////////////////////////////////////////////////
    // this method is called to reset various camera settings,
    // typically after creating or loading a camera
    ///////////////////////////////////////////////////////////
    public override void Refresh()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        m_PositionSpring.Stiffness =
            new Vector3(PositionSpringStiffness, PositionSpringStiffness, PositionSpringStiffness);
        m_PositionSpring.Damping = Vector3.one -
                                   new Vector3(PositionSpringDamping, PositionSpringDamping, PositionSpringDamping);

        m_PositionSpring2.Stiffness =
            new Vector3(PositionSpring2Stiffness, PositionSpring2Stiffness, PositionSpring2Stiffness);
        m_PositionSpring2.Damping = Vector3.one -
                                    new Vector3(PositionSpring2Damping, PositionSpring2Damping, PositionSpring2Damping);

        m_RotationSpring.Stiffness =
            new Vector3(RotationSpringStiffness, RotationSpringStiffness, RotationSpringStiffness);
        m_RotationSpring.Damping = Vector3.one -
                                   new Vector3(RotationSpringDamping, RotationSpringDamping, RotationSpringDamping);


        m_PositionSpring.MinState.y = PositionGroundLimit;
        m_PositionSpring.RestState  = PositionOffset;

        m_PositionSpring2.MinState.y = (-PositionOffset.y) + PositionGroundLimit;
        // we don't force a position offset for position spring 2

//		BobStepCallback = null;

        Zoom();

        if (CurrentWeapon != null)
        {
            CurrentWeapon.Refresh();
        }
        if (CurrentShooter != null)
        {
            CurrentShooter.Refresh();
        }
    }