Esempio n. 1
0
    void Awake()
    {
        m_CharacterCardVisualizer = gameObject.AddComponent <CardVisualizer>();
        m_CharacterCardVisualizer.RegisterOnActionActive((CardVisualizeEffect.EffectType effectType) =>
        {
            switch (effectType)
            {
            case CardVisualizeEffect.EffectType.AttackEffect:
                {
                    if (m_TargetCard != null)
                    {
                        if (m_TargetCard.isActiveAndEnabled)
                        {
                            m_TargetCard.OnCardAttacked();
                            m_TargetCard.CurrentHealthPoint -= m_AttackPoint;
                            m_TargetCard.StartCoroutine(m_TargetCard.UpdateCardStatus());
                            m_TargetCard = null;
                        }
                    }
                }
                break;

            case CardVisualizeEffect.EffectType.HitEffect:
                {
                    if (isActiveAndEnabled)
                    {
                        StartCoroutine(UpdateCardStatus());
                    }
                }
                break;

            case CardVisualizeEffect.EffectType.GlowingEffect:
                {
                }
                break;

            default:
                {}
                break;
            }
        });

        m_CharacterCardVisualizer.RegisterOnActionEnded(() =>
        {
            m_CardStatus = CardStatus.TurnActionEnded;
        });

        m_CardFrameWorkRenderer = gameObject.GetComponent <SpriteRenderer>();
    }