//Adds the agent and returns a ticket number public void Add(LSInfluencer influencer) { byte controllerID = influencer.Agent.Controller.ControllerID; if (AgentBuckets.Count <= controllerID) { //fill up indices up till the desired bucket's index for (int i = controllerID - AgentBuckets.Count; i >= 0; i--) { AgentBuckets.Add(null); } } FastBucket <LSInfluencer> bucket = AgentBuckets [controllerID]; if (bucket == null) { //A new bucket for the controller must be created bucket = new FastBucket <LSInfluencer> (); AgentBuckets [controllerID] = bucket; } influencer.NodeTicket = bucket.Add(influencer); AgentCount++; }
public void Remove(LSInfluencer influencer) { var bucket = AgentBuckets [influencer.Agent.Controller.ControllerID]; bucket.RemoveAt(influencer.NodeTicket); //Important! This ensure sync for the next game session. if (bucket.Count == 0) { //Buckets can be SoftCleared beause previous allocation flags will be outside the scope of the new bucket's cycle bucket.SoftClear(); } AgentCount--; }
public virtual void Setup(IAgentData interfacer) { gameObject.SetActive(true); LoadComponents(); GameObject.DontDestroyOnLoad(gameObject); setupAbilitys.FastClear(); MyAgentCode = interfacer.Name; Data = interfacer; SpawnVersion = 1; CheckCasting = true; Influencer = new LSInfluencer(); if (_visualCenter == null) { _visualCenter = CachedTransform; } if (Animator.IsNotNull()) { Animator.Setup(); } Body = UnityBody.InternalBody; Body.Setup(this); abilityManager.Setup(this); Influencer.Setup(this); SelectionRadiusSquared = SelectionRadius * SelectionRadius; this.RegisterLockstep(); // Setuped = true; }
public void Remove(LSInfluencer influencer) { LinkedScanNode.Remove(influencer); }
public void Add(LSInfluencer influencer) { LinkedScanNode.Add(influencer); }