Ejemplo n.º 1
0
    private void Explode()
    {
        Instantiate(explosionPrefab, transform.position, Quaternion.identity);

        animator.SetBool(animation_exploded, true);

        IBurnable[] burnables = BurnableCache.FindBurnablesAroundPoint(transform.position, explosionRadius);

        for (int i = 0; i < explosionTargetCount; i++)
        {
            Ignite(burnables[Random.Range(0, burnables.Length)]);
        }

        ExplosionAttributeChange();
    }
    private void Arson(IBurnable target)
    {
        Debug.LogWarning("Arson: " + target.transform.name);
        Ignite(target);
        Instantiate(original: explosionPrefab, position: target.transform.position, rotation: Quaternion.identity);

        float gasLeft = additionalFires;

        IBurnable[] burnables = BurnableCache.FindBurnablesAroundPoint(target.transform.position, currentRadius);

        while (gasLeft >= 0)
        {
            if (gasLeft >= 1 || Random.Range(0.0f, 1.0f) <= gasLeft)
            {
                Ignite(burnables[Random.Range(0, burnables.Length)]);
            }
            gasLeft--;
        }
    }