Esempio n. 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);
        }
Esempio n. 2
0
 public static void SetRetain(this WeaponEntity weaponEntity, EntityKey owner)
 {
     if (!owner.IsValid())
     {
         return;
     }
     weaponEntity.isFlagSyncSelf    = true;
     weaponEntity.isFlagSyncNonSelf = false;
     if (weaponEntity.hasOwnerId)
     {
         weaponEntity.ownerId.Value = owner;
     }
     else
     {
         weaponEntity.AddOwnerId(owner);
     }
 }