Example #1
0
    public override void InitEquipment(PeEntity entity, ItemAsset.ItemObject itemObj)
    {
        base.InitEquipment(entity, itemObj);
        m_Anim         = GetComponentInChildren <Animator>();
        m_MotionEquip  = m_Entity.GetCmpt <Motion_Equip>();
        m_ItemAmmoAttr = itemObj.GetCmpt <ItemAsset.Arrow>();
        if (null != m_ItemAmmoAttr)
        {
            m_CurIndex = m_ItemAmmoAttr.index;
        }

        if (null != m_ArrowBagTrans)
        {
            m_ArrowBagTrans.gameObject.SetActive(true);
            m_View.AttachObject(m_ArrowBagTrans.gameObject, m_ArrowBagBone);
            m_ArrowBagTrans.localPosition = Vector3.zero;
            m_ArrowBagTrans.localRotation = Quaternion.identity;
            m_ArrowBagTrans.localScale    = Vector3.one;
        }

        m_FingerBone = PETools.PEUtil.GetChild(m_View.modelTrans, m_ArrowFinger);
        if (null != m_LineBone)
        {
            m_LineBoneDefaultPos = m_LineBone.localPosition;
        }

        if (m_ArrowModel.Length != m_CostItemID.Length || m_SkillID.Length != m_CostItemID.Length)
        {
            Debug.LogError("ArrowModelNum, ItemNum, SkillNum not match");
        }

        m_StartTime = 0f;
        m_BowOpen   = false;
    }
Example #2
0
    public override void InitEquipment(PeEntity entity, ItemAsset.ItemObject itemObj)
    {
        base.InitEquipment(entity, itemObj);

        m_ItemAmmoAttr = itemObj.GetCmpt <ItemAsset.GunAmmo>();
        if (null != m_ItemAmmoAttr)
        {
            if (null != m_AmmoItemIDList && m_AmmoItemIDList.Length > m_ItemAmmoAttr.index)
            {
                m_CurAmmoItemIndex = m_ItemAmmoAttr.index;
            }

            if (null != m_Magazine)
            {
                if (m_ItemAmmoAttr.count < 0)
                {
                    m_ItemAmmoAttr.count = (int)magazineSize;
                }

                m_Magazine.m_Value = m_ItemAmmoAttr.count;
            }
        }

        m_ShellCaseTrans = PETools.PEUtil.GetChild(transform, "ShellCase");

        m_View = entity.biologyViewCmpt;

        if (null != m_View && null != m_MagazineObj)
        {
            if (null != m_View)
            {
                m_View.AttachObject(m_MagazineObj, "mountOff");
                m_MagazineObj.transform.localPosition = Vector3.zero;
                m_MagazineObj.transform.localRotation = Quaternion.identity;
            }
        }

        if (null != m_ChargeEffectGo)
        {
            EffectLateupdateHelper effect = m_ChargeEffectGo.AddComponent <EffectLateupdateHelper>();
            effect.Init(m_ChargeEffectGo.transform.parent);
            m_ChargeEffectGo.transform.parent = Pathea.Effect.EffectBuilder.Instance.transform;
        }
    }
Example #3
0
    protected virtual void Deserialize(System.IO.BinaryReader br)
    {
        int itemInstanceId = br.ReadInt32();

        ItemAsset.ItemObject itemObj = ItemMgr.Instance.Get(itemInstanceId);
        if (null != itemObj)
        {
            itemDrag = itemObj.GetCmpt <ItemAsset.Drag>();
        }
        else
        {
            Debug.LogError("[Error]Cant find item object by id:" + itemInstanceId);
            itemDrag = null;
        }

        mId  = br.ReadInt32();
        _pos = PETools.Serialize.ReadVector3(br);
        _sca = PETools.Serialize.ReadVector3(br);
        _rot = PETools.Serialize.ReadQuaternion(br);

        Create();
    }