Add temporary event discard handling.
This commit is contained in:
@@ -136,6 +136,11 @@ namespace Cryville.Crtr.Event {
|
||||
tev.Target = anchor;
|
||||
ts.Bus.PushTempEvent(tev);
|
||||
}
|
||||
public virtual void Discard(ContainerState s, StampedEvent ev) {
|
||||
if (ev is StampedEvent.Anchor) {
|
||||
anchorEvPool.Return((StampedEvent.Anchor)ev);
|
||||
}
|
||||
}
|
||||
public virtual void Update(ContainerState s, StampedEvent ev) {
|
||||
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;
|
||||
if (flag) PreAwake(s);
|
||||
|
@@ -314,6 +314,10 @@ namespace Cryville.Crtr.Event {
|
||||
Working = false;
|
||||
}
|
||||
|
||||
public void Discard(StampedEvent ev) {
|
||||
Handler.Discard(this, ev);
|
||||
}
|
||||
|
||||
public void Handle(StampedEvent ev) {
|
||||
if (breakflag) return;
|
||||
if (ev != null) {
|
||||
|
@@ -121,6 +121,12 @@ namespace Cryville.Crtr.Event {
|
||||
_dummyEvent.Time = Time;
|
||||
var index = tempEvents.BinarySearch(_dummyEvent);
|
||||
if (index < 0) index = ~index;
|
||||
for (var i = 0; i < index; i++) {
|
||||
var ev = tempEvents[i];
|
||||
if (ev.Container != null) {
|
||||
states[ev.Container].Discard(ev);
|
||||
}
|
||||
}
|
||||
tempEvents.RemoveRange(0, index);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user