Пример #1
0
    // constructor
    void Awake()
    {
        mCharaController = GetComponent <CharacterController>();
        mRigController   = GetComponent <RigidbodyController>();

        if (mRigController != null)
        {
            mRigController.mAutoUserControl = false;
            NetworkRigidbody nrb = GetComponent <NetworkRigidbody>();
        }

        mFwdLerp = this.transform.forward;

        mMeleeColliderNetBhv        = mMeleeCollider.GetComponent <MeleeColliderNetBhv>();
        mMeleeColliderNetBhv.mOwner = this.gameObject;
        mMeleeCollider.gameObject.SetActive(false);

        mDbgTxt = GetComponentInChildren <TextMesh>(true);

                #if USE_RIGID
        mRigidbody = GetComponent <Rigidbody>();
        if (mRigidbody != null)
        {
            _isRigidbody = false;
        }
                #endif

        Physics.IgnoreCollision(mSwordBhv.GetComponent <Collider>(), GetComponent <Collider>());
    }
Пример #2
0
    void Awake()
    {
        mRigidbody        = this.GetComponent <Rigidbody>();
        mNetworkRigidbody = this.GetComponent <NetworkRigidbody>();
        var cc = transform.GetComponent <CapsuleCollider>();

        mCapsuleH      = cc.height;
        mCapsuleRadius = cc.radius;
        //kinematic = true;
    }
Пример #3
0
 void OnValidate()
 {
     if (characterController == null)
     {
         characterController = GetComponent <CharacterController>();
     }
     if (capsuleCollider == null)
     {
         capsuleCollider = GetComponent <CapsuleCollider>();
     }
     if (networkRigidbody == null)
     {
         networkRigidbody = GetComponent <NetworkRigidbody>();
     }
 }