void Start() { if (!m_StatusComponent) { Debug.LogWarning("Couldn't get Boss Status Component. UI won't work properly"); } else { m_StatusComponent.AddOnTakeDamage(UpdateHealth); } }
void Start() { if (!m_MovementComponent) { m_MovementComponent = GetComponent <MovementComponent>(); if (!m_MovementComponent) { Debug.LogWarning("Actor MovementComponent wasn't successfully set or found. Actor won't be able to benefit from this component"); } else { m_MovementComponent.m_OnFlip = new UnityEngine.Events.UnityEvent(); m_MovementComponent.m_OnFlip.AddListener(FlipHand); } } if (!m_StatusComponent) { m_StatusComponent = GetComponent <StatusComponent>(); if (!m_StatusComponent) { Debug.LogWarning("Actor StatusComponent wasn't successfully set or found. Actor won't be able to benefit from this component"); } else { m_StatusComponent.AddOnDeath(PlayerDeath); m_StatusComponent.AddOnTakeDamage(MakePlayerInvulnerable); } } if (!m_SpellComponent) { m_SpellComponent = GetComponent <SpellCastingComponent>(); if (!m_SpellComponent) { Debug.LogWarning("Actor SpellCastingComponent wasn't successfully set or found. Actor won't be able to benefit from this component"); } } if (!m_WeaponComponent) { m_WeaponComponent = GetComponent <WeaponComponent>(); if (!m_WeaponComponent) { Debug.LogWarning("Actor WeaponComponent wasn't successfully set or found. Actor won't be able to benefit from this component"); } } m_WeaponComponent.SetTargetingFunction(() => { if (!target) { var vec3 = m_FirePoint.position - m_PlayerHand.transform.position; return(new Vector2(vec3.x, vec3.y)); } else { return(target.transform.position - m_FirePoint.position); } }); if (!m_EffectManager) { m_EffectManager = GetComponent <EffectManagerComponent>(); if (!m_EffectManager) { Debug.LogWarning("Actor EffectManagerComponent wasn't successfully set or found. Actor won't be able to benefit from this component"); } } }
// Start is called before the first frame update void Start() { objectStatusComponent.AddOnDeath(DestroyObject); objectStatusComponent.AddOnTakeDamage(HitObject); }