Add INotify(Activity)StanceChanged interfaces.

This commit is contained in:
Paul Chote
2019-05-19 15:29:56 +00:00
committed by abcdefg30
parent 07dc2a1132
commit 62b5d22e53
3 changed files with 39 additions and 0 deletions

View File

@@ -171,6 +171,20 @@ namespace OpenRA.Activities
act = act.childActivity;
}
}
public IEnumerable<T> ActivitiesImplementing<T>() where T : IActivityInterface
{
if (childActivity != null)
foreach (var a in childActivity.ActivitiesImplementing<T>())
yield return a;
if (this is T)
yield return (T)(object)this;
if (NextActivity != null)
foreach (var a in NextActivity.ActivitiesImplementing<T>())
yield return a;
}
}
public static class ActivityExts

View File

@@ -350,6 +350,8 @@ namespace OpenRA.Traits
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")]
public interface Requires<T> where T : class, ITraitInfoInterface { }
public interface IActivityInterface { }
[RequireExplicitImplementation]
public interface INotifySelected { void Selected(Actor self); }
[RequireExplicitImplementation]