Beispiel #1
0
 // Start is called before the first frame update
 void Awake()
 {
     mind         = GetComponent <CreatureMind>();
     goAi         = GetComponent <AIDestinationSetter>();
     wanderAI     = GetComponent <WanderingDestinationSetter>();
     ai           = GetComponent <RichAI>();
     maxSpeed     = ai.maxSpeed;
     nextDecision = Random.Range(0, brainTime);
     //testing!
     rb             = GetComponent <Rigidbody>();
     jumpTimeOffset = Random.Range(0, 9);
     text           = transform.GetChild(0).GetComponent <TextMesh>();
     text.text      = "";
     //test soundmaking
     sm      = GetComponent <SoundMaker>();
     ih      = gameObject.AddComponent <ItemHandler>();
     health  = gameObject.AddComponent <Health>();
     effects = new List <ParticleSystem>();
     chatLog = ChatLog.instance;
     foreach (Transform child in transform)
     {
         ParticleSystem s = child.GetComponent <ParticleSystem>();
         if (s)
         {
             effects.Add(s);
         }
     }
 }
Beispiel #2
0
    void FindChief()
    {
        CreatureMind tempChief = members[0];

        for (int i = 1; i < members.Count; i++)
        {
            if (members[i].Size > tempChief.Size)
            {
                tempChief = members[i];
            }
        }
        if (chief && chief != tempChief)//theres a new chief in town, old chief go away
        {
            chief.isChief = false;
        }
        chief         = tempChief;
        chief.isChief = true;
    }