public void Sync(GridAi ai, FocusData sync, bool localCall = false) { if (ai.Session.IsServer || sync.Revision > Revision) { Revision = sync.Revision; ActiveId = sync.ActiveId; HasFocus = sync.HasFocus; DistToNearestFocusSqr = sync.DistToNearestFocusSqr; for (int i = 0; i < Target.Length; i++) { Target[i] = sync.Target[i]; Locked[i] = sync.Locked[i]; } if (ai == ai.Construct.RootAi && localCall) { ai.Construct.UpdateLeafFoci(); } } //else Log.Line($"FocusData older revision: {sync.Revision} > {Revision}"); }
public bool Sync(GridAi ai, FocusData sync, bool localCall = false) { if (ai.Session.IsServer || sync.Revision > Revision) { Revision = sync.Revision; ActiveId = sync.ActiveId; HasFocus = sync.HasFocus; DistToNearestFocusSqr = sync.DistToNearestFocusSqr; for (int i = 0; i < Target.Length; i++) { Target[i] = sync.Target[i]; Locked[i] = sync.Locked[i]; } if (ai == ai.Construct.RootAi && localCall) { ai.Construct.UpdateLeafFoci(); } return(true); } return(false); }
public override void CleanUp() { base.CleanUp(); Data = null; }