void IdleTick() { UpdateGrab(); if (LastPullTarget != null) { Vector3 delta = LastPullTarget.Entity.Transform.WorldMatrix.TranslationVector - Entity.Transform.WorldMatrix.TranslationVector; if (delta.Length() < CollectRadius) { State = CollectionAreaState.Collecting; } } }
void CollectingTick() { if (LastPullTarget == null) { State = CollectionAreaState.Idle; return; } Vector3 delta = LastPullTarget.Entity.Transform.WorldMatrix.TranslationVector - Entity.Transform.WorldMatrix.TranslationVector; if (delta.Length() > CollectRadius) { State = CollectionAreaState.Idle; return; } if (LastPullTarget.Collect(this, CollectionSpeed * (float)Game.UpdateTime.Elapsed.TotalSeconds)) { OnCollect(LastPullTarget); State = CollectionAreaState.Idle; } }