Activates anchors only on set.

This commit is contained in:
2023-02-09 18:19:46 +08:00
parent 18ff4b8e16
commit 291a018c13

View File

@@ -102,6 +102,7 @@ namespace Cryville.Crtr.Event {
}
protected void OpenAnchor(Anchor anchor) {
if (OpenedAnchor != null) throw new InvalidOperationException("An anchor has been opened");
anchor.Transform.gameObject.SetActive(true);
OpenedAnchor = anchor;
}
protected void CloseAnchor() {
@@ -187,6 +188,7 @@ namespace Cryville.Crtr.Event {
if (Alive) {
if (!DynamicAnchorSet[_a_head]) PushAnchorEvent(cs.StampedContainer.Time, a_head, -1, true);
if (!DynamicAnchorSet[_a_tail]) PushAnchorEvent(cs.StampedContainer.Time + cs.StampedContainer.Duration, a_tail, 1, true);
foreach (var anchors in Anchors.Values) foreach (var anchor in anchors) anchor.Transform.gameObject.SetActive(false);
}
}
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool