示例#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)
        {
            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--;
        }
示例#3
0
        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;
        }
示例#4
0
 public void Remove(LSInfluencer influencer)
 {
     LinkedScanNode.Remove(influencer);
 }
示例#5
0
 public void Add(LSInfluencer influencer)
 {
     LinkedScanNode.Add(influencer);
 }