Example #1
0
    void Awake()
    {
        //adds component
        s_Projectile = ProjectileProcessor.ConfigureComponent(gameObject);
        //activates delayed detonation for some projectiles
        ExplosionType explodeType = GetExplosionType();

        if (explodeType == ExplosionType.Delay ||
            explodeType == ExplosionType.Detonate)
        {
            coro = StartCoroutine(WaitUntilDetonate());
        }

        //instantly explode this one because why not
        else if (explodeType == ExplosionType.Instant)
        {
            ExplodeProjectile();
        }
    }
    void Awake()
    {
        //adds component
        s_Projectile = ProjectileProcessor.ConfigureComponent(gameObject);
        //activates delayed detonation for some projectiles
        ExplosionType explodeType = GetExplosionType();

        /*
         *  CASE 1:
         *      - if it's animated projectile
         *      - AND the sprite list size isn't 0
         *      - AND the script inherits IAnimatedProjectile interface
         *
         *  CASE 2:
         *      - if projectile is either a delay or detonate-type
         *
         *  CASE 3:
         *      - if projectile is an instant-type
         */

        if (explodeType == ExplosionType.Delay ||
            explodeType == ExplosionType.Detonate)
        {
            coro = StartCoroutine(WaitUntilDetonate());
        }

        //instantly explode this one because why not
        else if (explodeType == ExplosionType.Instant)
        {
            ExplodeProjectile(scriptObject.explosionPrefab, scriptObject.explosionAmount);
        }

        else
        {
            coro = StartCoroutine(SetDespawnTime());
        }
    }