コード例 #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);
         }
     }
 }
コード例 #2
0
 void Start()
 {
     transform.rotation = Quaternion.identity;
     GetComponent <EnemyController>().SetHealth(maxHealth);
     storedHealth            = maxHealth;
     target                  = GameObject.Find("Player");
     aiPath                  = GetComponent <AIPath>();
     aiSetter                = GetComponent <AIDestinationSetter>();
     aiSetter.enabled        = false;
     wanderingSetter         = GetComponent <WanderingDestinationSetter>();
     wanderingSetter.enabled = false;
     animator                = GetComponent <Animator>();
 }