예제 #1
0
        public static EntityKey CreateCustomizeWeapon(EntityKey lastKey, EntityKey owner, int configId)
        {
            if (lastKey.IsValid())
            {
                WeaponEntity currWeapon = WeaponEntityFactory.GetWeaponEntity(lastKey);
                if (currWeapon != null)
                {
                    WeaponEntityFactory.RemoveWeaponEntity(currWeapon);
                }
            }
            WeaponEntity newWeapon = WeaponEntityFactory.CreateEntity(WeaponUtil.CreateScan(configId));

            newWeapon.SetRetain(owner);
            return(newWeapon.entityKey.Value);
        }
예제 #2
0
        /// <summary>
        /// release old weapon and create new one
        /// </summary>
        /// <param name="weaponSlotAgent"></param>
        /// <param name="Owner"></param>
        /// <param name="orient"></param>
        /// <param name="refreshParams"></param>
        /// <returns></returns>
        public override WeaponEntity ReplaceWeapon(EntityKey Owner, WeaponScanStruct orient, ref WeaponPartsRefreshStruct refreshParams)
        {
            refreshParams.lastWeaponKey = WeaponKey;
            ReleaseWeapon();
            var newEnity = WeaponEntityFactory.CreateEntity(orient);

            newEnity.SetRetain(Owner);
            //      DebugUtil.LogInUnity("add new weapon :{0}", DebugUtil.DebugColor.Blue, newEnity.entityKey.Value);
            if (orient.AvatarId < 1)
            {
                orient.AvatarId = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(orient.ConfigId).AvatorId;
            }
            WeaponPartsStruct parts = WeaponPartUtil.CreateParts(orient);

            refreshParams.weaponInfo   = orient;
            refreshParams.slot         = handledSlot;
            refreshParams.oldParts     = new WeaponPartsStruct();
            refreshParams.newParts     = parts;
            refreshParams.armInPackage = true;
            return(newEnity);
        }