Ejemplo n.º 1
0
    public void SpawnSpellBook(SpellSecondary secondary, Vector3 position)
    {
        SpellBook newSpellBook = Instantiate(spellBookPrefab, position, Quaternion.identity);

        newSpellBook.secondaryEffect = secondary;
        newSpellBook.secondaryEffect = secondarySpellEffects[Random.Range(0, secondarySpellEffects.Count)];
    }
Ejemplo n.º 2
0
    public void SpawnSpellBook(SpellPrimary primary, SpellSecondary secondary, Vector3 position)
    {
        SpellBook newSpellBook = Instantiate(spellBookPrefab, position, Quaternion.identity);

        newSpellBook.primaryEffect   = primary;
        newSpellBook.secondaryEffect = secondary;
    }
Ejemplo n.º 3
0
    public void SpawnSpell(SpellPrimary primary, SpellSecondary secondary)
    {
        SpellBook newSpellBook = Instantiate(bookPrefab, spawnPoint.position, spawnPoint.rotation);

        newSpellBook.primaryEffect   = primary;
        newSpellBook.secondaryEffect = secondary;
    }
Ejemplo n.º 4
0
    public SpellBook GenerateSpell(SpellPrimary primary, SpellSecondary secondary, Vector3 position) // Generate spell given primary, secondary, and location
    {
        SpellBook newSpellBook = Instantiate(spellBookPrefab, position, Quaternion.identity);

        newSpellBook.primaryEffect   = primary;
        newSpellBook.secondaryEffect = secondary;
        return(newSpellBook);
    }
Ejemplo n.º 5
0
    public void SpawnSpell(SpellSecondary secondary)
    {
        SpellBook    newSpellBook = Instantiate(bookPrefab, spawnPoint.position, spawnPoint.rotation);
        SpellPrimary newPrimary;

        if (OverridePrimaryEffects.Count != 0)
        {
            newPrimary = OverridePrimaryEffects[Random.Range(0, OverridePrimaryEffects.Count)];
        }                                                                                                                              // use this list if not empty
        else
        {
            newPrimary = SpellManager.Instance.primarySpellEffects[Random.Range(0, SpellManager.Instance.primarySpellEffects.Count)];
        }
        newSpellBook.primaryEffect = newPrimary;

        newSpellBook.secondaryEffect = secondary;
    }
Ejemplo n.º 6
0
    public ParticleSystem castEffect;                                                                    // particle effect when firing spell

    public virtual void ActivateSpell(SpellCaster user, SpellSecondary secondaryEffect, Vector3 fireDir) // When the spell is fired
    {
        Transform firingPoint = user.returnGun();

        if (firingPoint)
        {
            // Make sure we dont fire inside the user
            Vector3 firePoint = firingPoint.position;

            // Create spawn shots
            ParticleSystem            gunsmoke  = Instantiate(castEffect, firePoint, Quaternion.LookRotation(fireDir));
            ParticleSystem.MainModule smokeMain = gunsmoke.main;
            smokeMain.startColor = baseColor;
            Destroy(gunsmoke.gameObject, smokeMain.startLifetime.constant);

            // Create a new missile object
            Missile newProjectile = Instantiate(projectilePrefab, firePoint, Quaternion.LookRotation(fireDir));
            newProjectile.bounceCount     = 0;
            newProjectile.power           = power;
            newProjectile.duration        = duration;
            newProjectile.primaryEffect   = this;
            newProjectile.secondaryEffect = secondaryEffect;
            newProjectile.originator      = user.returnBody();

            // Modify rigidbody settings for takeoff
            Rigidbody projRbody = newProjectile.GetComponent <Rigidbody>();
            projRbody.useGravity = false;
            projRbody.AddForce(newProjectile.transform.forward * force, ForceMode.Impulse);

            // Apply visual effects
            ParticleSystem.MainModule main = newProjectile.sparkles.main;
            main.startColor = baseColor;
            TrailRenderer trail = newProjectile.trail;
            trail.startColor = baseColor;
            trail.endColor   = baseColor;

            // Apply secondary effects
            if (secondaryEffect != null)
            {
                secondaryEffect.MessUp(user.returnBody(), newProjectile);
            }
        }
    }
Ejemplo n.º 7
0
    public override void ActivateSpell(SpellCaster user, SpellSecondary secondaryEffect, Vector3 fireDir)
    {
        if (user.returnGun())
        {
            // Create a cast effect
            ParticleSystem            gunsmoke  = Instantiate(castEffect, user.returnGun().position, Quaternion.LookRotation(fireDir));
            ParticleSystem.MainModule smokeMain = gunsmoke.main;
            smokeMain.startColor = baseColor;
            Destroy(gunsmoke.gameObject, smokeMain.startLifetime.constant);

            // Create the healing missile
            Vector3 firePos       = Vector3.Lerp(user.returnGun().position, user.returnBody().position, 0.5f);
            Missile newProjectile = Instantiate(projectilePrefab, firePos, Quaternion.LookRotation(fireDir));
            newProjectile.bounceCount     = 0;
            newProjectile.power           = power;
            newProjectile.duration        = duration;
            newProjectile.primaryEffect   = this;
            newProjectile.secondaryEffect = secondaryEffect;
            newProjectile.originator      = user.returnBody();

            // Healing missiles do not have velocity!
            Rigidbody projRbody = newProjectile.GetComponent <Rigidbody>();
            projRbody.useGravity = true;
            projRbody.velocity   = Vector3.zero;

            // Apply visual effects
            ParticleSystem.MainModule main = newProjectile.sparkles.main;
            main.startColor = baseColor;
            TrailRenderer trail = newProjectile.trail;
            trail.startColor = baseColor;
            trail.endColor   = baseColor;

            // Apply secondary effects
            if (secondaryEffect != null)
            {
                secondaryEffect.MessUp(user.returnBody(), newProjectile);
            }
        }
    }
    public override void setup(Movement owner)
    {
        startingState   = new WizardEnemyIdle();
        owner.baseSpeed = baseSpeed;
        owner.maxSpeed  = maxSpeed;
        Damageable ownerDam = owner.GetComponent <Damageable>();

        ownerDam.max_health = health;
        owner.damage        = damage;
        owner.attackTarget  = GameObject.FindGameObjectWithTag(attackTargetTag).transform;

        // Add spellbook to enemy's inventory
        if (SpellManager.Instance != null)   // if spell manager is running
        {
            SpellCaster spellCaster = owner.GetComponent <SpellCaster>();

            if (!spellCaster.returnSpell())
            {
                SpellPrimary   primary      = possibleSpellPrimaries[Random.Range(0, possibleSpellPrimaries.Length)];
                SpellSecondary secondary    = possibleSpellSecondaries[Random.Range(0, possibleSpellSecondaries.Length)];
                SpellBook      newSpellBook = SpellManager.Instance.GenerateSpell(primary, secondary, owner.transform.position); // Create a new spellbook

                newSpellBook.Interact(spellCaster);
                newSpellBook.SetupSpell();
            }
        }

        /*
         * SpellBook newSpellBook = Instantiate(spellBookPrefab, owner.transform.position, owner.transform.rotation);
         * newSpellBook.primaryEffect = possibleSpellPrimaries[Random.Range(0, possibleSpellPrimaries.Length)];
         * newSpellBook.secondaryEffect = possibleSpellSecondaries[Random.Range(0, possibleSpellSecondaries.Length)];
         *
         * // Have enemy pick up spellbook
         * SpellCaster spellCaster = owner.GetComponent<SpellCaster>();
         * newSpellBook.Interact(spellCaster);
         */

        base.setup(owner);
    }
Ejemplo n.º 9
0
 public override void ActivateSpell(SpellCaster user, SpellSecondary secondaryEffect, Vector3 fireDir)
 {
     base.ActivateSpell(user, secondaryEffect, fireDir);
 }