Ejemplo n.º 1
0
    protected override void FireBulletAtEnemy(GameObject trackedObject)
    {
        //Gets a copy of the bullet from the object pooler
        GameObject bulletInstance = ObjectPooler.SharedInstance.GetPooledObject(bulletFired.tag);

        //Then, the bullet is repositioned to the firing indicator's position
        bulletInstance.transform.position = bulletHolder.transform.position;
        //Finally, the bullet's attributes are set up and the bullet is enabled and ready to go
        bulletInstance.GetComponent <BulletDispatcher>().SetupProjectile(damage, trackedObject, splashDamage: splashDamage, debuffDuration: debuffDuration, splashRange: splashRange, movementSpeedMultiplier: movementSpeedMultiplier);
        bulletInstance.SetActive(true);

        //Gets a copy of the bullet from the object pooler
        GameObject effectInstance = ObjectPooler.SharedInstance.GetPooledObject(nova.tag);

        //Then, the bullet is repositioned to the firing indicator's position
        effectInstance.transform.position = transform.position;
        //Setup the hitbox script of the splash effect
        HitboxScript splash     = effectInstance.GetComponent <HitboxScript>();
        Buff         splashBuff = new Buff(name: "Slow", duration: debuffDuration, speedMultiplier: movementSpeedMultiplier);

        splash.SetupHitboxScript(splashDamage, splashRange, new List <Buff>()
        {
            splashBuff
        });
        effectInstance.SetActive(true);
    }
Ejemplo n.º 2
0
    protected override void InstantiateHitEffect(GameObject effect, Vector3 position, Quaternion rotation)
    {
        if (effect != null)
        {
            //Gets a copy of the hit effect from the object pool
            GameObject effectInstance = ObjectPooler.SharedInstance.GetPooledObject(effect.tag);

            //Setup the hitbox script of the splash effect
            HitboxScript splash     = effectInstance.GetComponent <HitboxScript>();
            Buff         splashBuff = new Buff(name: debuffName, duration: debuffDuration, speedMultiplier: movementSpeedMultiplier);
            splash.SetupHitboxScript(splashDamage, splashRange, new List <Buff>()
            {
                splashBuff
            });
            //Moves the hit effect to a given position and rotation
            effectInstance.transform.position = position;
            effectInstance.transform.rotation = rotation;
            effectInstance.SetActive(true);

            //The particle effect will be killed in another script called KillParticles
        }
    }