internal override bool Init(GameObject owner, BasicAIController controller) { bool isSuccess = false; m_InventorySource = owner.GetComponent <BasicInventory>(); isSuccess = m_InventorySource != null; Debug.Assert(isSuccess, owner + " has a MotionControllerEquipWeapon AI behaviour but no BasicInventory component."); m_Combatant = owner.GetComponent <Combatant>(); isSuccess = m_Combatant != null; Debug.Assert(isSuccess, owner + " has a MotionControllerUnquipWeapon AI behaviour but no Combatant component."); isSuccess &= base.Init(owner, controller); if (isSuccess) { IsActive = true; return(true); } else { IsActive = false; return(true); } }
/// <summary> /// Called during the AIController Start method to initialize any components needed. /// <param name="owner">The parent GameObject for this behaviour.</param> /// <return>True if the behaviour has been correctly initialized.</return> /// </summary> internal virtual bool Init(GameObject owner, BasicAIController controller) { m_Owner = owner; m_Controller = controller; for (int i = 0; i < m_Conditions.Length; i++) { m_Conditions[i] = Instantiate(m_Conditions[i]); // instantiate so that a single SO is not shared across GameObjects m_Conditions[i].Init(this); } return(m_IsActive); }
internal override bool Init(GameObject owner, BasicAIController controller) { bool isSuccess = false; m_MotionController = owner.GetComponent <MotionController>(); isSuccess = m_MotionController != null; Debug.Assert(isSuccess, owner + " has a MotionControllerMeleeAttack AI behaviour but no MotionController."); isSuccess &= base.Init(owner, controller); if (isSuccess) { IsActive = true; return(true); } else { IsActive = false; return(true); } }