public override IEnumerable <IModdable> GetPotentialBroadcastTargets() { List <IModdable> moddables = new List <IModdable>(); IModdable self = GetComponent <IModdable>(); if (ProvideUpwards == ProvideBehaviour.All) { IEnumerable <IModdable> upwards = GetComponentsInParent <IModdable>().Where(x => x != self); moddables.AddRange(upwards); } else if (ProvideUpwards == ProvideBehaviour.Single) { moddables.Add(GetComponentInParent <IModdable>()); } if (ProvideDownwards == ProvideBehaviour.All) { IEnumerable <IModdable> upwards = GetComponentsInChildren <IModdable>().Where(x => x != self); moddables.AddRange(upwards); } else if (ProvideDownwards == ProvideBehaviour.Single) { moddables.Add(GetComponentInChildren <IModdable>()); } if (ProvideSelf) { moddables.Add(self); } return(moddables); }
private void RemoveMod(IModdable moddable) { if (moddable != null) { moddable.Mods.RemoveMod(Mod.Identifier); } }
public bool ToPosition(Vector2 position, Quaternion rotation) { focusModdable = null; transform.position = position; transform.rotation = rotation; return(true); }
public bool Check(IModdable moddable) { if (moddable is IIdentifiable identifiable) { return(identifiable.Identifier == Identiifier); } return(false); }
public bool Check(IModdable moddable) { if (moddable is Structure structure) { return(Check(structure)); } return(false); }
public override bool CanMod(IModdable moddable) { if (Filters != null && Filters.Length > 0) { return(Filters.All(x => x.Check(moddable))); } return(true); }
public bool Check(IModdable moddable) { if (moddable is ITagged tagged) { return(Tags.All(x => tagged.HasTag(x))); } return(false); }
private bool AddMod(IModdable moddable) { if (Mod.CanMod(moddable)) { moddable.Mods.AddMod(Instantiate(Mod)); return(true); } return(false); }
public bool ToTransforms(Transform[] transforms) { IEnumerable <IModdable> moddableList = transforms.Select(x => x.GetComponent <IModdable>()); IModdable[] moddables = moddableList.Where(x => _modifier.IsComptabible(x)).ToArray(); if (moddables.Length > 0) { focusModdable = moddables[Mathf.Abs(_focusIndex % moddables.Length)]; return(true); } return(false); }
private void RemoveMods() { IModdable target = GetTarget(); if (target != null) { foreach (var provider in GetProviders()) { target.Mods.RemoveMod(provider.Mod.Identifier); provider.EnableComponents(); } } }
private void ApplyMods() { IModdable target = GetTarget(); if (target != null) { foreach (var provider in GetProviders()) { target.Mods.AddMod(provider.Mod); provider.DisableComponents(); } } }
public override IEnumerable <IModdable> GetPotentialBroadcastTargets() { foreach (Transform sibling in GetSiblings()) { if (IsAdjecent(sibling.gameObject)) { IModdable moddable = sibling.GetComponent <IModdable>(); if (moddable != null && Mod.CanMod(moddable)) { yield return(moddable); } } } }
private IModdable GetTarget() { foreach (Transform child in transform) { if (IsTargetPosition(child.localPosition)) { IModdable moddable = child.GetComponent <IModdable>(); if (moddable != null) { return(moddable); } } } return(null); }
public override void RemoveEffect(IModdable target) { IStatContainer container = target as IStatContainer; Stat stat = container.GetStat(Identifier); switch (Type) { case StatType.Additive: stat.RemoveAdditive(this); break; case StatType.Multiplicative: stat.RemoveMultiplicative(this); break; } }
public override void ApplyEffect(IModdable target) { _target = target; IStatContainer container = target as IStatContainer; Stat stat = container.GetStat(Identifier); //TODO: Consider having StatType be a member of Stat instead of StatMod, then handling how to add the stat in Stat. switch (Type) { case StatType.Additive: stat.AddAdditive(Value.Get() * Coeffecient.Get(), this); break; case StatType.Multiplicative: stat.AddMultiplicative(Value.Get() * Coeffecient.Get(), this); break; } }
public bool Check(IModdable moddable) { return(Filters.Any(x => x.Check(moddable))); }
public abstract void OnRemove(IModdable moddable);
public override void OnRemove(IModdable moddable) { moddable.ResetDash(); }
public abstract void OnApply(IModdable moddable);
public override void OnRemove(IModdable moddable) { moddable.ResetSize(); }
public static void RemoveMod(Mod mod, IModdable moddable) { mod.RemoveEffect(moddable); }
public abstract void RemoveEffect(IModdable target);
public abstract void ApplyEffect(IModdable target);
public virtual bool IsCompatible(IModdable target) { Tag[] targetTags = target.GetModTags(); return(targetTags.Contains(ModTag)); }
public static void ApplyMod(Mod mod, IModdable moddable) { mod.ApplyEffect(moddable); }
public override void OnApply(IModdable moddable) { moddable.SetSpeed(reductionPercentage); }
public override void OnApply(IModdable moddable) { moddable.SetSize(incrementPercentage); }
public override void RemoveEffect(IModdable target) { IEventContainer container = target as IEventContainer; container.GetEvent(Event).Detach(Handler); }
public abstract bool CanMod(IModdable moddable);
public bool Check(IModdable moddable) { return(!ToInvert.Check(moddable)); }