/// <summary>
        /// Remove all agents from the slots they currently paticipate in and delete them.
        /// </summary>
        public void killAll()
        {
            for (int i = 0; i < spawnedObjects.Length; i++)
            {
                if (spawnedObjects [i] != null)
                {
                    NEEDSIM.NEEDSIMNode node = spawnedObjects[i].GetComponent <NEEDSIM.NEEDSIMNode>();

                    Simulation.Slot activeSlot = node.Blackboard.activeSlot;
                    node.AffordanceTreeNode.Remove();

                    if (activeSlot != null)
                    {
                        activeSlot.AgentDeparture();
                    }
                    else
                    {
                        Debug.Log("Active slot was null");
                    }



                    GameObject.Destroy(spawnedObjects[i]);
                    PopulationCount--;
                }
            }
        }
Beispiel #2
0
        public virtual void Start()
        {
            animator     = GetComponentInChildren <Animator>();
            needsimNode  = GetComponent <NEEDSIM.NEEDSIMNode>();
            navMeshAgent = needsimNode.GetComponent <NavMeshAgent>();

            //navMeshAgent.updatePosition = false;
        }
Beispiel #3
0
        void Start()
        {
            needsimNode = gameObject.GetComponent <NEEDSIM.NEEDSIMNode>();

            animators = new Animator[SpritesForSlots.Length];
            for (int i = 0; i < SpritesForSlots.Length; i++)
            {
                animators[i] = SpritesForSlots[i].GetComponent <Animator>();
            }
        }
Beispiel #4
0
        void Start()
        {
            if (Slider.Length != NeedNames.Length)
            {
                Debug.LogError("NeedsUI is not correctly set up.");
            }

            outlines       = new Outline[NeedNames.Length];
            NEEDSIMNode    = gameObject.GetComponent <NEEDSIM.NEEDSIMNode>();
            targetRotation = Camera.main.transform.rotation;

            for (int i = 0; i < Slider.Length; i++)
            {
                outlines[i] = Slider[i].fillRect.gameObject.AddComponent <Outline>();
                outlines[i].effectDistance = new Vector2(0.2f, -0.2f);
            }
        }
Beispiel #5
0
 public virtual void Start()
 {
     animator    = GetComponentInChildren <Animator>();
     needsimNode = GetComponent <NEEDSIM.NEEDSIMNode>();
 }