예제 #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++;
        }
예제 #2
0
 public void Remove(LSInfluencer influencer)
 {
     if (LinkedScanNode != null)
     {
         LinkedScanNode.Remove(influencer);
     }
 }
예제 #3
0
 public void Add(LSInfluencer influencer)
 {
     if (LinkedScanNode != null)
     {
         LinkedScanNode.Add(influencer);
     }
 }
예제 #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);
        }
예제 #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--;
		}
예제 #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--;
        }
예제 #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++;
        }
예제 #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;
 }
예제 #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;
        }
예제 #11
0
 public void Remove(LSInfluencer influencer)
 {
     LocatedAgents[influencer.Agent.Controller.ControllerID].RemoveAt(influencer.NodeTicket);
     AgentCount--;
 }
예제 #12
0
 public void Remove(LSInfluencer influencer)
 {
     LinkedScanNode.Remove(influencer);
 }
예제 #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--;
                    }
                }
            }
        }
예제 #15
0
 public void Remove(LSInfluencer influencer)
 {
     LocatedAgents.Remove (influencer);
 }
예제 #16
0
 public bool Add(LSInfluencer influencer)
 {
     if (System.Object.ReferenceEquals (LocatedAgents,null))
     {
         LocatedAgents = new InfluencerBucket();
     }
     return LocatedAgents.Add(influencer);
 }