Example #1
0
        //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++;
        }
Example #2
0
 public void Remove(LSInfluencer influencer)
 {
     if (LinkedScanNode != null)
     {
         LinkedScanNode.Remove(influencer);
     }
 }
Example #3
0
 public void Add(LSInfluencer influencer)
 {
     if (LinkedScanNode != null)
     {
         LinkedScanNode.Add(influencer);
     }
 }
Example #4
0
        //Adds the agent and returns a ticket number
        public void Add(LSInfluencer influencer)
        {
            byte teamID = influencer.Agent.Controller.ControllerID;
            FastBucket <LSInfluencer> bucket;

            if (!LocatedAgents.TryGetValue(teamID, out bucket))
            {
                bucket = new FastBucket <LSInfluencer>();
                LocatedAgents.Add(teamID, bucket);
            }
            influencer.NodeTicket = bucket.Add(influencer);
        }
Example #5
0
		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--;
		}
Example #6
0
        public void Remove(LSInfluencer influencer)
        {
            var bucket = LocatedAgents [influencer.Agent.Controller.ControllerID];

            bucket.RemoveAt(influencer.NodeTicket);
            //Important! This ensure sync for the next game session.
            if (bucket.Count == 0)
            {
                bucket.SoftClear();
            }
            AgentCount--;
        }
Example #7
0
        //Adds the agent and returns a ticket number
        public void Add(LSInfluencer influencer)
        {
            byte teamID = influencer.Agent.Controller.ControllerID;
            FastBucket <LSInfluencer> bucket;

            if (!LocatedAgents.TryGetValue(teamID, out bucket))
            {
                bucket = new FastBucket <LSInfluencer>();
                LocatedAgents.Add(teamID, bucket);
                FastIterationBuckets.Add(new KeyValuePair <byte, FastBucket <LSInfluencer> >(teamID, bucket));
            }
            influencer.NodeTicket = bucket.Add(influencer);
            AgentCount++;
        }
Example #8
0
        public 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();
            }


            abilityManager.Setup(this);
            Ringer = RingController.Create();
            if (Ringer.IsNotNull())
            {
                Ringer.Setup(this);
            }

            Influencer.Setup(this);
            Body.Setup(this);

            SelectionRadiusSquared = _selectionRadius * _selectionRadius;
            if (StatsBarer != null)
            {
                StatsBarer.Setup(this);
            }

            this.RegisterLockstep();
        }
 public bool Add(LSInfluencer item)
 {
     leIndex = OpenSlots.Count > 0 ? OpenSlots.Pop () : PeakCount++;
     if (leIndex >= MaxCapacity)
     {
         PeakCount = MaxCapacity;
         return false;
     }
     if (PeakCount == Capacity)
     {
         Capacity *= 2;
         if (Capacity > MaxCapacity) Capacity = MaxCapacity;
         Array.Resize (ref innerArray, Capacity);
     }
     LSUtility.SetBitTrue(ref arrayAllocation,leIndex);
     item.bucketIndex = leIndex;
     innerArray[leIndex] = item;
     return true;
 }
Example #10
0
        public 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;
        }
Example #11
0
 public void Remove(LSInfluencer influencer)
 {
     LocatedAgents[influencer.Agent.Controller.ControllerID].RemoveAt(influencer.NodeTicket);
     AgentCount--;
 }
Example #12
0
 public void Remove(LSInfluencer influencer)
 {
     LinkedScanNode.Remove(influencer);
 }
Example #13
0
 public void Add(LSInfluencer influencer)
 {
     LinkedScanNode.Add(influencer);
 }
        public void Remove(LSInfluencer item)
        {
            leIndex = item.bucketIndex;
            OpenSlots.Add (leIndex);

            LSUtility.SetBitFalse (ref arrayAllocation, leIndex);
            if (leIndex == PeakCount - 1)
            {
                PeakCount--;
                for (i = leIndex - 1; i >= 0; i--)
                {
                    if (LSUtility.GetBitFalse (arrayAllocation,i))
                    {
                        PeakCount--;
                    }
                }
            }
        }
 public void Remove(LSInfluencer influencer)
 {
     LocatedAgents.Remove (influencer);
 }
 public bool Add(LSInfluencer influencer)
 {
     if (System.Object.ReferenceEquals (LocatedAgents,null))
     {
         LocatedAgents = new InfluencerBucket();
     }
     return LocatedAgents.Add(influencer);
 }