Example #1
0
 public void ChangeEquip()
 {
     //DBItem itemDB = ZTConfig.Instance.GetDBItem(pEquipID);
     //string[] modelPaths = { itemDB.Model_R, itemDB.Model_L };
     //EquipAvatar pModel = GetEquipModelsByPos(pDressPos);
     //for (int i = 0; i < 2; i++)
     {
         string path = "Model/Weapon/120004";//modelPaths[i];
         string bone = Define.EQUIP_BONES[7, 0];
         //if (string.IsNullOrEmpty(path)) { continue; }
         Transform boneTrans = GTTools.GetBone(CacheTransform, bone);
         if (boneTrans == null)
         {
             return;
         }
         //pModel.Models[i] = ZTResource.Instance.Load<GameObject>(path, true);
         GameObject eObj = ZTResource.Instance.Load <GameObject>(path, true);
         if (eObj != null)
         {
             GameObject model = eObj;
             model.transform.parent = boneTrans;
             NGUITools.SetLayer(eObj, Obj.layer);
             model.transform.localPosition    = Vector3.zero;
             model.transform.localEulerAngles = Vector3.zero;
             model.transform.localScale       = Vector3.one;
         }
     }
 }
Example #2
0
        public override void Execute()
        {
            base.Execute();
            Transform bindBoneSt = GTTools.GetBone(CacheTransform, "Bone001");
            Transform bindBoneEd = GTTools.GetBone(CacheTransform, "Bone002");

            if (SrcCharacter != null)
            {
                Transform bindBone = SrcCharacter.Avatar.GetBindTransform(mLightObj.CasterBind);
                bindBoneSt.position = bindBone != null ? bindBone.position : (SrcCharacter.Pos + Vector3.up * 1);
            }
            if (DstCharacter != null)
            {
                Transform bindBone = DstCharacter.Avatar.GetBindTransform(mLightObj.TargetBind);
                bindBoneEd.position = bindBone != null ? bindBone.position : (DstCharacter.Pos + Vector3.up * 1);
            }
            else
            {
                bindBoneEd.position = SrcCharacter.Pos + SrcCharacter.Dir * mLightObj.MaxDis;
            }
            if (mHitCallback != null)
            {
                mHitCallback.Invoke(this);
                mHitCallback = null;
            }
        }
Example #3
0
 //获取手掌列表
 public Transform[] GetHands()
 {
     if (mHands == null && CacheTransform != null)
     {
         mHands    = new Transform[2];
         mHands[0] = GTTools.GetBone(CacheTransform, "Bip01 L Hand");
         mHands[1] = GTTools.GetBone(CacheTransform, "Bip01 R Hand");
     }
     return(mHands);
 }
Example #4
0
 public CharacterAvatar(Transform root)
 {
     this.mRoot         = root;
     this.mRootObj      = mRoot.gameObject;
     this.mRidePoint    = GTTools.GetBone(mRoot, "Bone026");
     this.mHand1        = GTTools.GetBone(mRoot, "Bip01 Prop1");
     this.mHand2        = GTTools.GetBone(mRoot, "Bip01 Prop2");
     this.mBodyTrans    = GTTools.GetBone(mRoot, "BP_Spine");
     this.mHeadTrans    = GTTools.GetBone(mRoot, "BP_Head");
     this.mBuffTrans    = GTTools.GetBone(mRoot, "BP_Buff");
     this.mAnimator     = mRootObj.GetComponent <Animator>();
     this.mShadow       = mRoot.Find("shadow");
     this.mSkinRenderer = mRoot.GetComponentInChildren <SkinnedMeshRenderer>();
     this.mSkinMaterial = this.mSkinRenderer == null ? null : this.mSkinRenderer.material;
     this.mSkinShader   = this.mSkinMaterial == null ? null : this.mSkinMaterial.shader;
     this.mEquipArray   = new int[8];
 }
    public bool AddForce(string bindName, Vector3 force)
    {
        Transform bindTrans = GTTools.GetBone(m_root, bindName);

        if (bindTrans == null)
        {
            return(false);
        }
        bool success = this.EnableRagdoll(true);

        if (success)
        {
            m_fStartTime = Time.time;
            m_force      = force;
            m_bindTrans  = bindTrans;
        }
        return(success);
    }