public override TaskStatus OnUpdate() { if (m_Vitals == null) { BiteMeCharacter character; if (target.Value != null) { character = target.Value.GetComponent<BiteMeCharacter>(); } else { character = this.gameObject.GetComponent<BiteMeCharacter>(); } m_Vitals = character.Vitals; } // If this objet doesn't have health or is dead, then it's a fail if (m_Vitals == null || m_Vitals.CurrentHealth <= 0) { return TaskStatus.Failure; } else { return TaskStatus.Success; } }
public override TaskStatus OnUpdate() { if (m_Vitals == null) { BiteMeCharacter character = this.gameObject.GetComponent<BiteMeCharacter>(); if (character != null) { m_Vitals = character.Vitals; } } // If this objet doesn't have health, then this task can't be done! if (m_Vitals == null) { return TaskStatus.Failure; } healthValue.Value = m_Vitals.CurrentHealth; armorValue.Value = m_Vitals.CurrentArmor; return TaskStatus.Success; }
public override void OnReset() { base.OnReset(); m_Vitals = null; }