Ejemplo n.º 1
0
    public override void OnStartEvent(GameObject src, OnStartData data)
    {
        StatusComponent status = src.AddComponent <StatusComponent>() as StatusComponent;

        status.SetMaxHealth(data.m_StatusComponentData.m_Health);
        status.Heal(data.m_StatusComponentData.m_Health, GameplayStatics.DamageType.Null);
        status.m_CanUseIFrames       = data.m_StatusComponentData.m_Health > 0;
        status.m_IFrameTime          = data.m_StatusComponentData.m_IFrameTime;
        status.m_DamagePopupOverride = data.m_StatusComponentData.m_OverrideDmgType;
        status.AddOnDeath(() => Destroy(src));
    }
Ejemplo n.º 2
0
    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");
            }
        }
    }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     objectStatusComponent.AddOnDeath(DestroyObject);
     objectStatusComponent.AddOnTakeDamage(HitObject);
 }