public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue(nameof(_bankTransform), _bankTransform); info.AddValue(nameof(Config), ItemPool.GetAssetLocation(Config)); }
protected virtual UIItemDragDrop SpawnPrefab() { return(ItemPool.SpawnUIPrefab <UIItemDragDrop>(StringConst.ItemDragDrop, _grid)); }
public CosmeticFlightBanking(SerializationInfo info, StreamingContext context) { _bankTransform = info.GetValue(nameof(_bankTransform), _bankTransform); Config = ItemPool.LoadAsset <FlightControlConfig>(info.GetValue(nameof(Config), "")); }
public static void Spawn(string text, float duration, Vector3 start, Vector3 end) { var spawn = ItemPool.Spawn <FloatingText>("UI/FloatingTextStandard", start, Quaternion.identity, true, false); spawn.StartText(text, duration, end); }
public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue(nameof(Config), ItemPool.GetAssetLocation(Config)); info.AddValue(nameof(CurrentMode), CurrentMode); info.AddValue(nameof(EnginesActivated), EnginesActivated); }
public static void Damage(float amount, Vector3 start) { var spawn = ItemPool.Spawn <FloatingText>("UI/FloatingTextDamage", start, Quaternion.identity, true, false); spawn.StartText(amount.ToString("F0"), 4f, start + DefaultEnd); }
public static void Message(string message, Vector3 start) { var spawn = ItemPool.Spawn <FloatingText>("UI/FloatingTextStandard", start, Quaternion.identity, true, false); spawn.StartText(message, 4f, start + DefaultEnd); }
public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue(nameof(Value), ItemPool.GetAssetLocation(Value)); }
public ActionFxComponent(SerializationInfo info, StreamingContext context) { ItemPool.LoadAsset <ActionFx>(info.GetValue(nameof(Value), ""), a => Value = a); }
public FakeFlightEngine(SerializationInfo info, StreamingContext context) { ItemPool.LoadAsset <FakeFlightEngineConfig>(info.GetValue(nameof(Config), ""), a => Config = a); }
IEnumerator Despawn() { yield return(_time); ItemPool.Despawn(gameObject); }
public static Entity CreateItem(ItemConfig data, int level) { var entity = Entity.New(data.ID); entity.Add(new TypeId(data.ID)); if (!string.IsNullOrEmpty(data.Icon)) { entity.Add(new IconComponent(ItemPool.LoadAsset <Sprite>(UnityDirs.ItemIcons, data.Icon))); } else { entity.Add(new IconComponent(SpriteDatabase.Item)); } entity.Add(new EntityLevelComponent(level)); if (data.TypeComponents != null) { World.Get <DataFactory>().AddComponentList(entity, data.Data, data.TypeComponents); } if (data.Components != null) { World.Get <DataFactory>().AddComponentList(entity, data.Data, data.Components); } ItemModifierFactory.AddModifiers(data.ModifierGroup, level, entity); StringBuilder sbName = new StringBuilder(); StringBuilder sbDescr = new StringBuilder(); sbDescr.Append(data.Description); var prefix = entity.Get <ItemModifierPrefix>(); var suffix = entity.Get <ItemModifierSuffix>(); if (prefix != null) { var prefixLabel = prefix.Data.TryGetValue(DatabaseFields.Name, ""); if (!string.IsNullOrEmpty(prefixLabel)) { sbName.Append(prefixLabel); sbName.Append(" "); } var prefixDescr = prefix.Data.TryGetValue(DatabaseFields.Description, ""); if (!string.IsNullOrEmpty(prefixDescr)) { sbDescr.NewLine(); sbDescr.Append(prefixDescr); } } sbName.Append(data.Name); if (suffix != null) { var suffixLabel = suffix.Data.TryGetValue(DatabaseFields.Name, ""); if (!string.IsNullOrEmpty(suffixLabel)) { sbName.Append(" "); sbName.Append(suffixLabel); } var suffixDescr = suffix.Data.TryGetValue(DatabaseFields.Description, ""); if (!string.IsNullOrEmpty(suffixDescr)) { sbDescr.NewLine(); sbDescr.Append(suffixDescr); } } entity.Add(new LabelComponent(sbName.ToString())); entity.Add(new DescriptionComponent(sbDescr.ToString())); var dataDescr = entity.Add(new DataDescriptionComponent()); entity.Post(new DataDescriptionAdded(dataDescr)); return(entity); }