public static bool animateFloatListObject( this MovieClipSnapshot snapshot, string id, PropertyModifier <List <float> > modifier, float delay = 0, float?duration = null, PropertyModifier <List <float> > from = null, Curve curve = null ) { return(snapshot.animateTo <List <float> >( id, paramName: "progress", target: progress => { var ret = progress.ToList(); modifier(ret); return ret; }, delay: delay, duration: duration, from: from != null ? (PropertyProvider <List <float> >)(progress => { var ret = progress.ToList(); from(ret); return ret; }) : null, curve: curve )); }
public void AddModifier(PropertyModifier modifier) { modifier.StackChanged += OnModifierStackChanged; Modifiers.Add(modifier); Modifiers = Modifiers.OrderBy(m => m.Type).ToList(); OnChange(); }
private string PropertyModifierValueString(PropertyModifier modifier, bool absolute = false) { modifier.Entity = modifier.Entity ?? CharacterManager.Instance.Character.Entity; modifier.ChangeStack(StackCount); var property = modifier.Entity.GetComponent <PropertiesComponent>().Get(modifier.Property.Id); var contains = property.Modifiers.Contains(modifier); if (contains) { property.Modifiers.Remove(modifier); } var value = property.Value(); var delta = modifier.Modify(value) - value; delta = absolute ? Mathf.Abs(delta) : delta; if (contains) { property.Modifiers.Add(modifier); } return(Property.ValueString(modifier.Property.Type, delta)); }
private void ProcessBuffs() { Color avatarColor = GameDefines.defaultAvatarColor; foreach (var kvp in bufDct) { ClientServerCommon.Buff buffCfg = ConfigDatabase.DefaultCfg.ActionConfig.GetBuffById(kvp.Value.bufID); if (buffCfg == null) { continue; } for (int modifierSetIdx = 0; modifierSetIdx < buffCfg.modifierSets.Count; ++modifierSetIdx) { ClientServerCommon.PropertyModifierSet modifierSetCfg = buffCfg.modifierSets[modifierSetIdx]; for (int idx = 0; idx < modifierSetCfg.modifiers.Count; ++idx) { PropertyModifier modifier = modifierSetCfg.modifiers[idx]; if (modifier.type != PropertyModifier._Type.ColorModifier) { continue; } avatarColor = new UnityEngine.Color(modifier.color.r, modifier.color.g, modifier.color.b, modifier.color.a); } } } avatar.SetColor(avatarColor); }
private void PropertyReset(PropertyModifier propertyModifier) { switch (propertyModifier) { case PropertyModifier.Damage: projectileDamageMultiplier = 1; break; case PropertyModifier.FireRate: fireRateMultiplier = 1; break; case PropertyModifier.AOE: projectileAOEMultiplier = 1; break; case PropertyModifier.Range: rangeMultiplier = 1; break; case PropertyModifier.ProjectileSpeed: projectileSpeedMultiplier = 1; break; } OnPropertyReset?.Invoke(propertyModifier); RemoveParticlesForModifier(propertyModifier); }
public static string AsString(this PropertyModifier modifier) { if (modifier == PropertyModifier.None) { return(string.Empty); } return(EnumToLower(modifier)); }
public void RemoveModifier(PropertyModifier modifier) { var fraction = this.health.HealthFraction; Get(modifier.Property.Type).RemoveModifier(modifier); this.health.Health = this.health.HealthMax * fraction; }
private void RemoveParticlesForModifier(PropertyModifier propertyModifier) { activeModifiers.Remove(propertyModifier); foreach (GameObject particle in particles[propertyModifier]) { OnParticleEnded(particle); } }
public void ApplyModifier(PropertyModifier modifier) { var fraction = this.health.HealthFraction; modifier.Entity = gameObject; Get(modifier.Property.Type).AddModifier(modifier); this.health.Health = this.health.HealthMax * fraction; }
private string PropertyModifierValueString(PropertyModifier modifier, bool absolute = false) { modifier.Entity = modifier.Entity ?? CharacterManager.Instance.Character.Entity; var value = modifier.Modify(0); value = absolute ? Mathf.Abs(value) : value; return(Property.ValueString(modifier.Property.Type, value)); }
public static PropertyGenerator Property(AccessModifier scope, PropertyModifier modifier, Type returnType, string name, bool hasDefault) { var prop = new PropertyGenerator(); prop.scope = scope; prop.modifier = modifier; prop.name = name; prop.returnType = returnType; return(prop); }
private static string ApplyModifier(PropertyModifier modifier, string input) { switch (modifier) { case PropertyModifier.None: return(input); case PropertyModifier.Lower: return(input.ToLowerInvariant()); default: throw new NotSupportedException($"Don't know how to apply modifier {modifier} to '{input}'"); } }
public static PropertyGenerator Property(AccessModifier scope, PropertyModifier modifier, string returnType, string name, bool hasDefault, bool isPrimitive, bool isValueType) { var prop = new PropertyGenerator(); prop.scope = scope; prop.modifier = modifier; prop.name = name; prop.returnTypeString = returnType; prop.returnTypeIsString = true; prop.stringIsPrimitive = isPrimitive; prop.stringIsValueType = isValueType; return(prop); }
public static PropertyGenerator Property(AccessModifier scope, PropertyModifier modifier, string assemblyQualifiedReturnType, string name, bool hasDefault, bool isPrimitive, bool isValueType) { var prop = new PropertyGenerator(); prop.scope = scope; prop.modifier = modifier; prop.name = name; prop.assemblyQualifiedReturnType = assemblyQualifiedReturnType; prop.useAssemblyQualifiedReturnType = true; prop.assemblyQualifiedIsPrimitive = isPrimitive; prop.assemblyQualifiedIsValueType = isValueType; return(prop); }
private static string ExtractNameAndModifier(string rawInput, out PropertyModifier modifier) { string[] chunks = rawInput.Split(s_modifierNameSplitter); if (chunks.Length < 2) { modifier = PropertyModifier.None; return(rawInput); } else if (chunks.Length == 2) { modifier = (PropertyModifier)Enum.Parse(typeof(PropertyModifier), chunks[0], true); return(chunks[1]); } else { throw new NotSupportedException($"{chunks.Length - 1} modifiers were found in '{rawInput}', only one is supported."); } }
public IFieldModifier[] GetFields() { FieldInfo[] fields = this.GetFieldInfos(); PropertyInfo[] properties = this.GetPropertyInfos(); IFieldModifier[] result = new IFieldModifier[fields.Length + properties.Length]; int i = 0; for (; i < fields.Length; ++i) { result[i] = new FieldModifier(fields[i]); } for (int j = 0; j < properties.Length; ++j, ++i) { result[i] = new PropertyModifier(properties[j]); } return(result); }
public Attribute(AttributeData data, IPropertyRepository propertyRepository) { Id = data.Id; Index = data.Index; Type = data.Type; Name = I18N.Instance.Get(data.NameKey); Description = I18N.Instance.Get(data.DescriptionKey); Icon = data.Icon; IsPrimary = data.IsPrimary; foreach (var propertyModifierData in data.PropertyModifiers) { var modifier = new PropertyModifier( propertyRepository.Find(propertyModifierData.PropertyId), propertyModifierData ); this.propertyModifiers.Add(modifier); } }
public ModifyStatsBehaviour(ModifyStatsBehaviourData data, IAttributeRepository attributeRepository, IPropertyRepository propertyRepository, List <Validator> validators) : base(data, validators) { foreach (var attributeModifierData in data.AttributeModifiers) { var modifier = new AttributeModifier( attributeRepository.Find(attributeModifierData.AttributeId), attributeModifierData ); this.attributeModifiers.Add(modifier); } foreach (var propertyModifierData in data.PropertyModifiers) { var modifier = new PropertyModifier( propertyRepository.Find(propertyModifierData.PropertyId), propertyModifierData ); this.propertyModifiers.Add(modifier); } }
public void RemoveModifier(PropertyModifier <List <ActivatedAbility> > modifier) { _abilities.RemoveModifier(modifier); }
public void AddModifier(PropertyModifier <List <ActivatedAbility> > modifier) { _abilities.AddModifier(modifier); }
private void CopyObject(StringBuilder buffer, object instance, string prefix) { if (instance != null) { Type type = instance.GetType(); object[] actions; if (this.typeDrawers.TryGetValue(type, out actions) == true) { buffer.AppendLine((actions[1] as Func <object, string, string>)(instance, prefix)); } else { if (instance.GetType().IsArray == true) { IEnumerable array = instance as IEnumerable; foreach (object element in array) { this.CopyObject(buffer, element, " "); } } else if (type != typeof(string) && (type.IsClass == true || type.IsStruct() == true)) { ClassDefinition classDefinition; if (this.refMembers.TryGetValue(type, out classDefinition) == false) { int j = 0; FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance); PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); IFieldModifier[] members = new IFieldModifier[fields.Length + properties.Length]; for (int i = 0; i < fields.Length; i++, ++j) { members[j] = new FieldModifier(fields[i]); } for (int i = 0; i < properties.Length; i++, ++j) { members[j] = new PropertyModifier(properties[i]); } classDefinition = new ClassDefinition(members); this.refMembers.Add(type, classDefinition); } for (int i = 0; i < classDefinition.members.Length; i++) { this.CopyObject(buffer, classDefinition.members[i].GetValue(instance), " " + classDefinition.nicifiedNames[i] + " : "); } } else { buffer.AppendLine(prefix + instance.ToString()); } } } else { buffer.AppendLine(prefix + "NULL"); } }
public void RemoveModifier(PropertyModifier modifier) { modifier.StackChanged -= OnModifierStackChanged; Modifiers.Remove(modifier); OnChange(); }
public void AddPowerModifier(PropertyModifier<int?> modifier) { _power.AddModifier(modifier); }
public void AddToughnessModifier(PropertyModifier<int?> modifier) { _toughness.AddModifier(modifier); }
public void AddModifier(PropertyModifier <List <StaticAbility> > modifier) { _abilities.AddModifier(modifier); }
public void RemovePowerModifier(PropertyModifier <int?> modifier) { _power.RemoveModifier(modifier); }
public void RemoveToughnessModifier(PropertyModifier <int?> modifier) { _toughness.RemoveModifier(modifier); }
public void AddToughnessModifier(PropertyModifier <int?> modifier) { _toughness.AddModifier(modifier); }
public void AddPowerModifier(PropertyModifier <int?> modifier) { _power.AddModifier(modifier); }
public void RemoveModifier(PropertyModifier <List <StaticAbility> > modifier) { _abilities.RemoveModifier(modifier); }
public void AddModifier(PropertyModifier <List <TriggeredAbility> > modifier) { _abilities.AddModifier(modifier); }
public void RemovePowerModifier(PropertyModifier<int?> modifier) { _power.RemoveModifier(modifier); }
public void RemoveModifier(PropertyModifier <List <TriggeredAbility> > modifier) { _abilities.RemoveModifier(modifier); }
public void RemoveToughnessModifier(PropertyModifier<int?> modifier) { _toughness.RemoveModifier(modifier); }