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OME4WDIAMZJ4VXD7SOEBAC
CD5FF75KTOBTMVMTMCKMR6F5DFKOF26I5K43ITNHGBI3ZAZHA4RAC
HXTSBPAP75A7EC4RKWYQMVPPHPNZFPHUORBZWDHGEB6MPAGI7G7AC
public void ApplyTagsEffect(TagCounter tags, Transform origin, AreaOfEffect areaOfEffect) {
switch (areaOfEffect.shape) {
case AoeShape.SingleTarget: ApplyTagsEffectSingle(tags, origin); break;
case AoeShape.Path: ApplyTagsEffectPath(tags, origin, areaOfEffect); break;
case AoeShape.Radius: ApplyTagsEffectRadius(tags, origin, areaOfEffect); break;
case AoeShape.Cone: ApplyTagsEffectCone(tags, origin, areaOfEffect); break;
public void ApplyTagsEffect(TagCounter tags, Transform origin, IAreaOfEffect areaOfEffect) {
switch (areaOfEffect) {
case SingleTarget _: ApplyTagsEffectSingle(tags, origin); break;
case CircleArea aoe: ApplyTagsEffectRadius(tags, origin, aoe); break;
case ConeArea aoe: ApplyTagsEffectCone(tags, origin, aoe); break;
case PathArea aoe: ApplyTagsEffectPath(tags, origin, aoe); break;
// TODO: might want to set it in context?
public float length;
public float width;
public AoeShape shape;
return shape switch {
AoeShape.SingleTarget => AffectSingle(origin),
AoeShape.Radius => AffectRadius(origin),
AoeShape.Cone => AffectCone(origin),
AoeShape.Path => AffectPath(origin),
_ => throw new IndexOutOfRangeException(),
};
}
IEnumerable<Transform> AffectSingle(Transform origin) {
RaycastHit[] hits = Physics.SphereCastAll(origin.position, radius, origin.forward, 0, LayerMask.NameToLayer("units"));
[Serializable]
public class CircleArea : IAreaOfEffect
{
public float Radius;
public IEnumerable<Transform> GetAffectedUnits(Transform origin) {
RaycastHit[] hits = Physics.SphereCastAll(origin.position, Radius, origin.forward, 0, LayerMask.NameToLayer("units"));
IEnumerable<Transform> AffectCone(Transform origin) {
float radius = width;
float coneAngle = Mathf.Asin(width / 2 * length);
}
[Serializable]
public class ConeArea : IAreaOfEffect
{
public float Length;
public float Width;
public IEnumerable<Transform> GetAffectedUnits(Transform origin) {
float radius = Width;
float coneAngle = Mathf.Asin(Width / 2 * Length);
RaycastHit[] hits = Physics.SphereCastAll(origin.position, radius, origin.forward, length, LayerMask.NameToLayer("units"));
[Serializable]
public class PathArea : IAreaOfEffect
{
public float Radius;
public float Length;
public IEnumerable<Transform> GetAffectedUnits(Transform origin) {
RaycastHit[] hits = Physics.SphereCastAll(origin.position, Radius, origin.forward, Length, LayerMask.NameToLayer("units"));
// Consider changing AreaOfEffect to Value type
if (context.AreaOfEffect == null) {
context.AreaOfEffect = new();
}
context.AreaOfEffect.length = _areaOfEffect.length;
context.AreaOfEffect.width = _areaOfEffect.width;
context.AreaOfEffect.shape = _areaOfEffect.shape;
context.AreaOfEffect = _areaOfEffect.ShallowCopy();
- rid: 7043444504695668750
type: {class: CircleArea, ns: , asm: Assembly-CSharp}
data:
Radius: 15
- rid: 7043444504695668753
type: {class: DelayedEffect, ns: TagFighter.Effects, asm: Assembly-CSharp}