Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (m_isEnabled)
        {
            CharacterBehaviour otherCharacter = other.gameObject.GetComponent <CharacterBehaviour>();

            if (otherCharacter && !m_targetsHitWhilstActive.Contains(otherCharacter))
            {
                m_targetsHitWhilstActive.Add(otherCharacter);
                otherCharacter.Damage(m_damage);
            }
        }
    }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        //Debug.Log("Collision with " + other.gameObject.name);

        if (!m_isActive)
        {
            return;
        }

        CharacterBehaviour otherCharacter = other.gameObject.GetComponent <CharacterBehaviour>();

        if (otherCharacter && !m_targetsHitWhilstActive.Contains(otherCharacter))
        {
            m_targetsHitWhilstActive.Add(otherCharacter);
            otherCharacter.Damage(m_damage);
        }
    }
Example #3
0
    public override void Activate(CharacterBehaviour character, bool evolved, Vector2Int position, Vector2Int targetPosition)
    {
        switch (m_aoe)
        {
        case TrapAOE.LineHorizontal:
        {
            StartCoroutine(DoDamage(1.2f + (targetPosition.x - position.x) * 0.2f, character, evolved));
            break;
        }

        case TrapAOE.LineVertical:
        {
            StartCoroutine(DoDamage(1.2f + (position.y - targetPosition.y) * 0.2f, character, evolved));
            break;
        }

        default:
        {
            character.Damage(evolved ? ((DamageTrap)Evolution).Damage : m_damage);
            break;
        }
        }
    }
Example #4
0
    private IEnumerator DoDamage(float duration, CharacterBehaviour character, bool evolved)
    {
        yield return(new WaitForSeconds(duration));

        character.Damage(evolved ? ((DamageTrap)Evolution).Damage : m_damage);
    }