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YZH26UGYPQC
S5OSCH7CRN2YEKVTCTJXNLYR2B3PEGCCBUGTN2M6QOCKBNJR62NAC
DGUHVA7XX4HWCIXCARJCI7T6VTXEJUOPUYZOLDOOOWIZYFEJQYFQC
ROTMK5LNNK7T5YXVOMUODVMCQWIHPZYOME4WDIAMZJ4VXD7SOEBAC
CD5FF75KTOBTMVMTMCKMR6F5DFKOF26I5K43ITNHGBI3ZAZHA4RAC
HXTSBPAP75A7EC4RKWYQMVPPHPNZFPHUORBZWDHGEB6MPAGI7G7AC
XF52N4U7HWXOF4PDSCR7LCUENLTSXLWEZGS2IJ6562KYI567Z2GAC
IDXWT3DH3C3X7PP4VVKUZTCGDALW6NH7KREI4E2VFQVMCBJKDMTAC
// TODO: Inject this for real
context = new EffectContext(null, new EffectSystem( GameObject.Find("RippleOutVfx").GetComponent<ParticleSystem>())) {
// TODO: Inject this for real
context = new EffectContext(null, new EffectSystem(GameObject.Find("RippleOutVfx").GetComponent<ParticleSystem>())) {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ApplyDamageEffect : IEffect
{
public void Effect(EffectContext context) {
context.EffectsToTrigger.Add(this);
}
public void Apply(EffectContext context) {
// TODO: Do damage
}
}
[SerializeField] bool FriendOrFoeOff;
using UnityEngine;
using System;
using System.Linq;
public class ApplyTagsEffect : IEffect
{
[SerializeField] bool FriendOrFoeOff;
public void Effect(EffectContext context) {
context.EffectsToTrigger.Add(this);
}
public void Apply(EffectContext context) {
// TODO: Apply friendOrFoeOff
var targets = context.GetEffectedUnits().Select(t => t.GetComponent<TaggableUnit>()).Where(t => t!=null);
context.TagSystem?.ApplyTags(targets, context.CurrentTags.AsEnumerable());
// TODO: Change it to real effect
context.EffectSystem.ApplyTagsEffect(context.CurrentTags, context.EffectLocation, context.AreaOfEffect);
}
}
fileFormatVersion: 2
guid: d5e2a4a772bd54e40b9e51267815eab7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RemoveTagsEffect : IEffect
{
[SerializeField] TagColor Color;
[SerializeField] float Multiplicative = 1f;
[SerializeField] float Flat;
[SerializeField] bool MultiplicativeBeforeFlat;
public void Effect(EffectContext context) {
if (MultiplicativeBeforeFlat) {
context.AddedTags[Color] = context.AddedTags[Color] / Multiplicative - Flat;
}
}
else {
context.AddedTags[Color] = (context.AddedTags[Color] - Flat) * Multiplicative;
}
}
public void Apply(EffectContext context) {}
[Serializable]
using System;
fileFormatVersion: 2
guid: 89ef4ba6de097824f9a8ba6ace237e79
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
public class CountTagsEffect : IEffect
{
[SerializeField] TagColor Color;
[SerializeField] bool FriendOrFoeOff;
public void Effect(EffectContext context) {
}
public void Apply(EffectContext context) {
Debug.Log("CountTagsEffect: Apply");
context.EffectsToTrigger.Add(this);
var targets = context.GetEffectedUnits();
// TODO: Apply friendOrFoeOff
float amount = 0;
foreach (Transform traget in targets) {
TaggableUnit taggableUnit = traget.gameObject.GetComponent<TaggableUnit>();
amount += taggableUnit.CurrentTags[Color];
}
}
}
context.CurrentTags[Color] += amount;
context.EffectSystem.ApplyTagsEffect(tags, context.EffectLocation, context.AreaOfEffect);
TagCounter tags = new() { };
tags[Color] += amount;
fileFormatVersion: 2
guid: cb70d05d12788114ab0bd0d627425cfd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class AddTagsEffect : IEffect
{
public void Effect(EffectContext context) {
if (MultiplicativeBeforeFlat) {
context.AddedTags[Color] = context.AddedTags[Color] * Multiplicative + Flat;
}
else {
context.AddedTags[Color] = (context.AddedTags[Color] + Flat) * Multiplicative;
}
}
public void Apply(EffectContext context) {}
}
[SerializeField] bool MultiplicativeBeforeFlat;
[SerializeField] float Flat;
[SerializeField] TagColor Color;
[SerializeField] float Multiplicative;
fileFormatVersion: 2
guid: 09fd81e877086164c84715b32d79d803
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class AccumulateDamageByTagEffect : IEffect
{
public void Effect(EffectContext context) {
context.CurrentDamage += Multiplier * context.CurrentTags[Color];
}
public void Apply(EffectContext context) {}
}
[SerializeField] TagColor Color;
[SerializeField] float Multiplier = 1f;
fileFormatVersion: 2
guid: 76558d8a30a1c664daf90f5afd7fdac1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using TagFighter.Resources;
using UnityEngine;
namespace TagFighter.Effects.RemoveResource
{
public class RemoveResourceEffect<TResource, TUnit> : IEffect
where TResource : Resource<TUnit>
where TUnit : IUnit
{
[SerializeField] float Multiplicative = 1f;
[SerializeField] Unit<TUnit> Flat;
[SerializeField] bool MultiplicativeBeforeFlat;
readonly string _effectName = $"Remove({typeof(TResource).Name})Effect";
public void Apply(EffectContext context) {
Debug.Log($"{_effectName}: Apply");
}
public void Effect(EffectContext context) {
Debug.Log($"{_effectName}: Effect");
Unit<TUnit> newAdded = MultiplicativeBeforeFlat?
context.GetAdded<TResource, TUnit>() / Multiplicative - Flat :
(context.GetAdded<TResource, TUnit>() - Flat) * Multiplicative;
context.SetAdded<TResource, TUnit>(newAdded);
}
}
public sealed class RemovePainEffect : RemoveResourceEffect<Pain, PainUnit> { }
public sealed class RemoveFatigueEffect : RemoveResourceEffect<Fatigue, FatigueUnit> { }
public sealed class RemoveBlueTagEffect : RemoveResourceEffect<BlueTag, BlueTagUnit> { }
public sealed class RemoveRedTagEffect : RemoveResourceEffect<RedTag, RedTagUnit> { }
public sealed class RemoveGreenTagEffect : RemoveResourceEffect<GreenTag, GreenTagUnit> { }
}
public class EffectContext :
IResourceContext<Pain, PainUnit>,
IResourceContext<Fatigue, FatigueUnit>,
IResourceContext<BlueTag, BlueTagUnit>,
IResourceContext<RedTag, RedTagUnit>,
IResourceContext<GreenTag, GreenTagUnit>
{
public dynamic CurrentResourceCounter { get; set; } = new ExpandoObject();
public TagCounter CurrentTags { get; set; } = new TagCounter();
public TagCounter CurrentTags { get; set; } = new TagCounter();
public TagCounter AddedTags { get; set; } = new TagCounter();
public TagCounter RemovedTags { get; set; } = new TagCounter();
public Transform Caster { get; set; }
public Transform EffectLocation { get; set; }
public List<IEffect> EffectsToTrigger { get; set; } = new List<IEffect>();
public Unit<TUnit> GetCurrent<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit {
if (!ResourceCounter.TryGetValue(typeof(TResource), out var resourceContext)) {
resourceContext = new ResourceContext<TUnit>();
ResourceCounter.Add(typeof(TResource), resourceContext);
}
return ((ResourceContext<TUnit>)resourceContext).Current;
}
public TagSystem TagSystem { get; private set; }
public Unit<TUnit> SetCurrent<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit {
if (!ResourceCounter.TryGetValue(typeof(TResource), out var resourceContext)) {
resourceContext = new ResourceContext<TUnit>();
ResourceCounter.Add(typeof(TResource), resourceContext);
}
((ResourceContext<TUnit>)resourceContext).Current = value;
return ((ResourceContext<TUnit>)resourceContext).Current;
}
public Unit<TUnit> GetAdded<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit {
if (!ResourceCounter.TryGetValue(typeof(TResource), out var resourceContext)) {
resourceContext = new ResourceContext<TUnit>();
ResourceCounter.Add(typeof(TResource), resourceContext);
}
return ((ResourceContext<TUnit>)resourceContext).Added;
}
public EffectSystem EffectSystem { get; private set; }
Unit<PainUnit> IResourceContext<Pain, PainUnit>.Current { get; set; }
Unit<PainUnit> IResourceContext<Pain, PainUnit>.Added { get; set; }
Unit<PainUnit> IResourceContext<Pain, PainUnit>.Removed { get; set; }
Unit<FatigueUnit> IResourceContext<Fatigue, FatigueUnit>.Current { get; set; }
Unit<FatigueUnit> IResourceContext<Fatigue, FatigueUnit>.Added { get; set; }
Unit<FatigueUnit> IResourceContext<Fatigue, FatigueUnit>.Removed { get; set; }
Unit<BlueTagUnit> IResourceContext<BlueTag, BlueTagUnit>.Current { get; set; }
Unit<BlueTagUnit> IResourceContext<BlueTag, BlueTagUnit>.Added { get; set; }
Unit<BlueTagUnit> IResourceContext<BlueTag, BlueTagUnit>.Removed { get; set; }
Unit<RedTagUnit> IResourceContext<RedTag, RedTagUnit>.Current { get; set; }
Unit<RedTagUnit> IResourceContext<RedTag, RedTagUnit>.Added { get; set; }
Unit<RedTagUnit> IResourceContext<RedTag, RedTagUnit>.Removed { get; set; }
Unit<GreenTagUnit> IResourceContext<GreenTag, GreenTagUnit>.Current { get; set; }
Unit<GreenTagUnit> IResourceContext<GreenTag, GreenTagUnit>.Added { get; set; }
Unit<GreenTagUnit> IResourceContext<GreenTag, GreenTagUnit>.Removed { get; set; }
public Unit<TUnit> GetCurrent<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Current;
}
public Unit<TUnit> SetAdded<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit {
if (!ResourceCounter.TryGetValue(typeof(TResource), out var resourceContext)) {
resourceContext = new ResourceContext<TUnit>();
ResourceCounter.Add(typeof(TResource), resourceContext);
}
((ResourceContext<TUnit>)resourceContext).Added = value;
return ((ResourceContext<TUnit>)resourceContext).Added;
}
public Unit<TUnit> GetRemoved<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit {
if (!ResourceCounter.TryGetValue(typeof(TResource), out var resourceContext)) {
resourceContext = new ResourceContext<TUnit>();
ResourceCounter.Add(typeof(TResource), resourceContext);
}
return ((ResourceContext<TUnit>)resourceContext).Removed;
}
public Unit<TUnit> SetCurrent<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Current = value;
}
public Unit<TUnit> GetAdded<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Added;
}
public Unit<TUnit> SetRemoved<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit {
if (!ResourceCounter.TryGetValue(typeof(TResource), out var resourceContext)) {
resourceContext = new ResourceContext<TUnit>();
ResourceCounter.Add(typeof(TResource), resourceContext);
}
((ResourceContext<TUnit>)resourceContext).Removed = value;
return ((ResourceContext<TUnit>)resourceContext).Removed;
}
public Unit<TUnit> SetAdded<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Added = value;
}
public EffectContext(TagSystem tagSystem, EffectSystem effectSystem) {
TagSystem = tagSystem;
EffectSystem = effectSystem;
}
public EffectContext(TagSystem tagSystem, EffectSystem effectSystem) {
TagSystem = tagSystem;
EffectSystem = effectSystem;
}
public IEnumerable<Transform> GetEffectedUnits() {
if (AreaOfEffect == null) {
return Enumerable.Empty<Transform>();
}
return AreaOfEffect.GetEffectedUnits(EffectLocation);
}
public IEnumerable<Transform> GetEffectedUnits() {
if (AreaOfEffect == null) {
return Enumerable.Empty<Transform>();
private void ResetEffects() {
ResourceCounter = new();
CurrentTags = new();
EffectsToTrigger = new();
private void ResetEffects() {
CurrentTags = new TagCounter();
AddedTags = new TagCounter();
RemovedTags = new TagCounter();
EffectsToTrigger = new List<IEffect>();
CurrentDamage = 0;
}
public void Reset() {
ResetEffects();
}
ResetEffects();
private interface IResourceContext { };
private class ResourceContext<TUnitType> : IResourceContext
where TUnitType : IUnit
{
public Unit<TUnitType> Current { get; set; }
public Unit<TUnitType> Added { get; set; }
public Unit<TUnitType> Removed { get; set; }
}
public void Effect(EffectContext context) {
Debug.Log("CountTagsImmidiateEffect: Effect");
var targets = AreaOfEffect.GetEffectedUnits(context.EffectLocation).Select(t => t.GetComponent<TaggableUnit>()).Where(t => t!=null);
// TODO: Apply friendOrFoeOff
float amount = 0;
foreach (TaggableUnit taggableUnit in targets) {
amount += taggableUnit.CurrentTags[Color];
}
context.CurrentTags[Color] += amount;
public void Effect(EffectContext context) {
Debug.Log("CountTagsImmidiateEffect: Effect");
var targets = AreaOfEffect.GetEffectedUnits(context.EffectLocation).Select(t => t.GetComponent<TaggableUnit>()).Where(t => t != null);
// TODO: Apply friendOrFoeOff
float amount = 0;
foreach (TaggableUnit taggableUnit in targets) {
amount += taggableUnit.CurrentTags[Color];
}
context.CurrentTags[Color] += amount;
TagCounter tags = new() { };
tags[Color] += amount;
// public class VarCountResourceEffect<TResource> : IEffect
// where TResource : IResource<IUnit>
// {
// readonly string _effectName = $"Count({typeof(TResource).Name})Effect";
// public void Apply(EffectContext context) {
// Debug.Log($"{_effectName}: Apply");
// var amount = context.GetEffectedUnits()
// .Select(transform => transform.GetComponent<TResource>())
// .Where(resource => resource != null)
// .Select(resource => resource.)
// .Aggregate((Unit<IUnit>)0, (sum, next) => sum += next);
// Unit<IUnit> unit;
// var a = context.VarGetCurrent<TResource>();
// }
// public void Effect(EffectContext context) {
// throw new System.NotImplementedException();
// }
// }
rid: 7043444400329588752
name: Count2
speed: 0.7
manaCost: 0
RuneSprite: {fileID: 21300000, guid: 83c355ff8b6edc54697f8fc305828dd2, type: 3}
rid: 7043444486337986561
- rid: 7043444486337986561
type: {class: ReleaseEffect, ns: TagFighter.Effects, asm: Assembly-CSharp}
data:
AreaOfEffect:
length: 15
width: 15
shape: 1