Пример #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Mouse"))
        {
            AthItem.Raise(new EventArgsItemAth(Weapon));
        }

        if (_playerData.Name == "Warrior")
        {
            if (isAttacking && other.CompareTag("Enemies"))
            {
                EnemiesLive s = other.gameObject.GetComponent <EnemiesLive>();
                s.GetDamaged(_playerData.PhysicsDamage + Weapon.PhysicsDamage + comp.AdDamage, _playerData.MagicDamage + Weapon.MagicDamage + comp.ApDamage);
                if (Weapon.EffectType != 0)
                {
                    s.Effect(Weapon.EffectType, Weapon.EffectDamage, Weapon.Duration);
                }
            }
        }
    }
Пример #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        string tag = other.gameObject.tag;

        if (other.gameObject.CompareTag("Wall") || other.gameObject.CompareTag("ObstaclesDestroy"))
        {
            Destroy(gameObject);
        }

        if (tag == _projectilesData.EnemyTag && tag == "Enemies")
        {
            if (--_projectilesData.Live <= 0)
            {
                Destroy(gameObject);
            }
            EnemiesLive e = other.transform.GetComponent <EnemiesLive>();

            e.GetDamaged(_projectilesData.DamageP, _projectilesData.DamageM);
            if (Random.Range(0, 100) < _projectilesData.Prob)
            {
                e.Effect(_projectilesData.Effect, _projectilesData.EffectDamage, _projectilesData.Duration);
            }
        }

        else if (tag == _projectilesData.BossTag && tag == "Boss")
        {
            if (--_projectilesData.Live <= 0)
            {
                Destroy(gameObject);
            }
            BossLive e = other.transform.GetComponent <BossLive>();

            e.GetDamaged(_projectilesData.DamageP, _projectilesData.DamageM);
        }

        else if (tag == "Player" && tag == _projectilesData.EnemyTag)
        {
            Damage.Raise(new EventArgsInt(_projectilesData.DamageP + _projectilesData.DamageM));
            Destroy(gameObject);
        }
    }