예제 #1
0
    protected virtual void Start()
    {
        _photonView  = PhotonView.Get(this);
        _animator    = GetComponent <Animator> ();
        _rigidbody   = GetComponent <Rigidbody> ();
        _capsule     = GetComponent <CapsuleCollider> ();
        _hsc         = GetComponent <HumanoidSpeedComponent> ();
        _hangHandler = GetComponentInChildren <HangHandler> ();

        if (!_hangHandler)
        {
//			print ("HangHandler not found");
        }
        _capsuleHeight = _capsule.height;
        _capsuleCenter = _capsule.center;

        _rigidbody.constraints   = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
        _origGroundCheckDistance = _groundCheckDistance;

        _hashFoward        = AnimationHashHelper.PARAM_FORWARD;
        _hashOnGround      = AnimationHashHelper.PARAM_ON_GROUND;
        _hashStrafe        = AnimationHashHelper.PARAM_STRAFE;
        _hashCrouch        = AnimationHashHelper.PARAM_CROUCH;
        _hashJump          = AnimationHashHelper.PARAM_JUMP;
        _hashStateHangIdle = AnimationHashHelper.STATE_HANG_IDLE;
    }
예제 #2
0
        void Start()
        {
            m_Animator      = GetComponent <Animator> ();
            m_Rigidbody     = GetComponent <Rigidbody> ();
            m_Capsule       = GetComponent <CapsuleCollider> ();
            _hangHandler    = GetComponentInChildren <HangHandler> ();
            m_CapsuleHeight = m_Capsule.height;
            m_CapsuleCenter = m_Capsule.center;

            m_Rigidbody.constraints   = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
            m_OrigGroundCheckDistance = m_GroundCheckDistance;

            _hashFoward        = AnimationHashHelper.PARAM_FORWARD;
            _hashOnGround      = AnimationHashHelper.PARAM_ON_GROUND;
            _hashTurn          = AnimationHashHelper.PARAM_TURN;
            _hashCrouch        = AnimationHashHelper.PARAM_CROUCH;
            _hashJump          = AnimationHashHelper.PARAM_JUMP;
            _hashJumpLeg       = AnimationHashHelper.PARAM_JUMP_LEG;
            _hashStateHangIdle = AnimationHashHelper.STATE_HANG_IDLE;
            _layerMask         = LayerHelper.TEAM_1_BODY;     // ignore collisions with this layer
        }