private void Start() { //make sure the enemy contains at least one ai logic if (GetComponents<AILogicBase>().Length == 0) { Debug.LogError("No AILogicBase component can be found on enemy gameobject (" + name + ")"); } Transform weapon_obj = transform.parent.FindChild("weapon"); if (weapon_obj == null) Debug.LogError("'weapon' object cannot be found in enemy parent's children"); weapon_inventory = weapon_obj.GetComponent<WeaponInventory>(); weapon_inventory.init(this); weapon_control = weapon_obj.GetComponent<EnemyWeaponControl>(); weapon_control.init(this); health = GetComponent<GenericHealth>(); health.init(this); }
private void Start() { //make sure the enemy contains at least one ai logic if (GetComponents <AILogicBase>().Length == 0) { Debug.LogError("No AILogicBase component can be found on enemy gameobject (" + name + ")"); } Transform weapon_obj = transform.parent.FindChild("weapon"); if (weapon_obj == null) { Debug.LogError("'weapon' object cannot be found in enemy parent's children"); } weapon_inventory = weapon_obj.GetComponent <WeaponInventory>(); weapon_inventory.init(this); weapon_control = weapon_obj.GetComponent <EnemyWeaponControl>(); weapon_control.init(this); health = GetComponent <GenericHealth>(); health.init(this); }