Esempio n. 1
0
    /// <summary>
    /// re-caches all of the standard UFPS local player components
    /// </summary>
    private static void RefreshPlayerComponents()
    {
        m_FPCamera        = null;
        m_FPController    = null;
        m_FPInput         = null;
        m_FPDamageHandler = null;
        m_FPWeaponHandler = null;
        m_Inventory       = null;
        m_Respawner       = null;
        m_FPBodyAnimator  = null;
        m_RagdollHandler  = null;
        m_FootFXHandler   = null;

        if (m_FPEventHandler == null)
        {
            return;
        }

        m_FPCamera        = m_FPEventHandler.GetComponentInChildren <vp_FPCamera>();
        m_FPController    = m_FPEventHandler.GetComponentInChildren <vp_FPController>();
        m_FPInput         = m_FPEventHandler.GetComponentInChildren <vp_FPInput>();
        m_FPDamageHandler = m_FPEventHandler.GetComponentInChildren <vp_FPPlayerDamageHandler>();
        m_FPWeaponHandler = m_FPEventHandler.GetComponentInChildren <vp_FPWeaponHandler>();
        m_Inventory       = m_FPEventHandler.GetComponentInChildren <vp_PlayerInventory>();
        m_Respawner       = m_FPEventHandler.GetComponentInChildren <vp_PlayerRespawner>();
        m_FPBodyAnimator  = m_FPEventHandler.GetComponentInChildren <vp_FPBodyAnimator>();
        m_RagdollHandler  = m_FPEventHandler.GetComponentInChildren <vp_RagdollHandler>();
        m_FootFXHandler   = m_FPEventHandler.GetComponentInChildren <vp_PlayerFootFXHandler>();
    }
Esempio n. 2
0
    /// <summary>
    /// this is used to prevent remote players from spawning with a
    /// falling animation. when they spawn at their temp (free fall)
    /// position, animators will get immediately paused and forcibly
    /// 'grounded' and unpaused as soon as they spawn properly
    /// </summary>
    public virtual void SetAnimated(bool value)
    {
        m_IsAnimated = value;

        vp_RagdollHandler v = transform.root.GetComponentInChildren <vp_RagdollHandler>();

        if (v != null)
        {
            v.enabled = value;
        }

        vp_BodyAnimator b = transform.root.GetComponentInChildren <vp_BodyAnimator>();

        if (b != null)
        {
            b.enabled = value;
        }

        Animator a = transform.root.GetComponentInChildren <Animator>();

        if (a != null)
        {
            a.SetBool("IsGrounded", true);
            a.enabled = value;
        }
    }