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}");
        }
示例#2
0
        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);
        }
示例#3
0
 public override void CleanUp()
 {
     base.CleanUp();
     Data = null;
 }