Пример #1
0
    // ========== Private methods ==========
    private void IncreaseRadiusUpdate()
    {
        if (_currentRadius >= radius)
        {
            return;
        }

        _currentRadius += Time.deltaTime * _currentRadiusIncreaseSpeed;

        Collider2D[] affectedColliders = Physics2D.OverlapCircleAll(transform.position, _currentRadius, _affectedLayer);
        foreach (Collider2D collider in affectedColliders)
        {
            SpriteRenderer renderer = collider.GetComponent <SpriteRenderer>();
            if (renderer == null)
            {
                continue;
            }
            if (!ObjectUtils.CheckIfSpriteAppearInScreen(renderer))
            {
                continue;
            }

            IShootableObject affectedObject = collider.GetComponent <IShootableObject>();
            affectedObject.OnAffectedByEffectObject(type, gameObject);
        }
    }
Пример #2
0
    private void OnDetonate()
    {
        Collider2D[] affectedColliders = Physics2D.OverlapCircleAll(transform.position, ((BombConfig)config).RADIUS, _affectedLayer);
        foreach (Collider2D collider in affectedColliders)
        {
            SpriteRenderer renderer = collider.GetComponent <SpriteRenderer>();
            if (renderer == null)
            {
                continue;
            }
            if (!ObjectUtils.CheckIfSpriteAppearInScreen(renderer))
            {
                continue;
            }

            IShootableObject affectedObject = collider.GetComponent <IShootableObject>();
            affectedObject.OnAffectedByEffectObject(type, gameObject);
        }
    }
Пример #3
0
    private void LightningStrike()
    {
        _lastStrokeObject    = _currentStrokeObject;
        _currentStrokeObject = GetAffectedObject(_lastStrokeObject);

        if (_currentStrokeObject == null)
        {
            return;
        }

        IShootableObject currentStrokeClass = _currentStrokeObject.GetComponent <IShootableObject>();

        currentStrokeClass.OnAffectedByEffectObject(EffectObjectType.LIGHTNING_BALL, gameObject);
        _affectedGameObject.Add(_currentStrokeObject);

        LightningBoltScript lightningBolt = _lightningBoltPool.GetObject().GetComponent <LightningBoltScript>();

        lightningBolt.transform.position = Vector3.zero;
        lightningBolt.StartObject        = _lastStrokeObject;
        lightningBolt.EndObject          = _currentStrokeObject;
        lightningBolt.ManualMode         = true;
        lightningBolt.Trigger();
    }