Exemplo n.º 1
0
    public void Initialize(ProjectileSpell s, Vector2 direction)
    {
        damage          = s.degats;
        projectileSpeed = s.projectileSpeed;

        this.gameObject.GetComponent <Rigidbody2D>().AddForce(direction * projectileSpeed);
    }
Exemplo n.º 2
0
 public void Setup(GameObject spellVFX, CombatEntity target, ProjectileSpell castedSpell, float projectileSpeed)
 {
     this.spellVFX = Instantiate(spellVFX, transform.position, Quaternion.identity);
     this.spellVFX.transform.SetParent(transform);
     this.target      = target;
     this.castedSpell = castedSpell;
     speed            = projectileSpeed;
 }
    public override void OnClickCard()
    {
        GameObject prefab = Resources.Load <GameObject>("prefabs/FireballPrefab");

        if (prefab == null)
        {
            Debug.Log("NULLLLLLLL");
        }
        prefab.AddComponent(typeof(DestroyOnCollide));
        ProjectileSpell.Fire(prefab, GetPlayerTransform(), 10);
    }
Exemplo n.º 4
0
    public override void TriggerWildcardAttack(WeaponEnum weaponMod)
    {
        //Debug.Log("Trigger LookClosely Attack");
        ProjectileSpell spell = AbilityHandler.Instance.Attack.Spell as ProjectileSpell;

        Debug.Log("<color=green>Trigger BadAtMath Attack</color>");
        Debug.Log("<color=green>Trigger BadAtMath old damage range: " + spell.DamageRange + "</color>");

        if (weaponMod != WeaponEnum.neutral)
        {
            spell.DamageRange = spell.BaseDamageRange + _tierStats[Tier - 1].DamageRangeFactor;
        }

        Debug.Log("<color=green>Trigger BadAtMath new damage range: " + spell.DamageRange + "</color>");
    }
Exemplo n.º 5
0
    public override void TriggerWildcardAttack(WeaponEnum weaponMod)
    {
        ProjectileSpell spell = AbilityHandler.Instance.Attack.Spell as ProjectileSpell;

        switch (weaponMod)
        {
        case WeaponEnum.barrel:
            spell.ProjectileSpread = spell.BaseProjectileSpread * _tierStats[Tier - 1].BarrelSpread;
            break;

        case WeaponEnum.blade:
            spell.ProjectileSpread = spell.BaseProjectileSpread + spell.BaseProjectileSpread * _tierStats[Tier - 1].BladeSpread;
            break;

        case WeaponEnum.magiccore:
            Debug.Log("<color=green>LookClosely Magiccore</color>");
            float aimDistance = _tierStats[Tier - 1].AimDistance;
            Debug.Log("Aim distance: " + aimDistance);
            RaycastHit[] hits         = Physics.SphereCastAll(GameObject.FindWithTag("Player").transform.position, _aimBotTolerance, spell.DirectionVector, aimDistance, Physics.AllLayers);
            RaycastHit   nearestEnemy = new RaycastHit();
            nearestEnemy.distance = aimDistance;
            foreach (RaycastHit hit in hits)
            {
                if (hit.collider.gameObject.layer == 8 && hit.collider.gameObject.CompareTag("Enemy"))
                {
                    if (nearestEnemy.distance >= hit.distance)
                    {
                        nearestEnemy = hit;
                    }
                }
            }
            if (nearestEnemy.collider != null)
            {
                Vector3 positionWithoutY = new Vector3(spell.BulletSpawn.position.x, 0, spell.BulletSpawn.position.z);
                Vector3 bulletVector     = nearestEnemy.transform.position - positionWithoutY;
                spell.DirectionVector = bulletVector;
            }

            break;

        case WeaponEnum.neutral:
            break;
        }
    }
Exemplo n.º 6
0
        public SpellProjectile(Farmer theSource, ProjectileSpell theSpell, int dmg, float theDir, float theVel, bool theSeeking)
            : this()
        {
            source        = theSource;
            spell         = theSpell;
            damage.Value  = dmg;
            dir.Value     = theDir;
            vel.Value     = theVel;
            seeking.Value = theSeeking;

            theOneWhoFiredMe.Set(theSource.currentLocation, source);
            position.Value        = source.getStandingPosition();
            position.X           += source.GetBoundingBox().Width;
            position.Y           += source.GetBoundingBox().Height;
            rotation              = theDir;
            xVelocity.Value       = (float)Math.Cos(dir) * vel;
            yVelocity.Value       = (float)Math.Sin(dir) * vel;
            damagesMonsters.Value = true;

            tex         = Content.loadTexture("magic/" + spell.ParentSchoolId + "/" + spell.Id + "/projectile.png");
            texId.Value = Content.loadTextureKey("magic/" + spell.ParentSchoolId + "/" + spell.Id + "/projectile.png");

            if (seeking)
            {
                float   nearestDist = float.MaxValue;
                Monster nearestMob  = null;
                foreach (var character in theSource.currentLocation.characters)
                {
                    if (character is Monster mob)
                    {
                        float dist = Utility.distance(mob.Position.X, position.X, mob.Position.Y, position.Y);
                        if (dist < nearestDist)
                        {
                            nearestDist = dist;
                            nearestMob  = mob;
                        }
                    }
                }

                seekTarget = nearestMob;
            }
        }
        public SpellProjectile(SFarmer theSource, ProjectileSpell theSpell, int dmg, float theDir, float theVel)
        {
            source = theSource;
            spell  = theSpell;
            damage = dmg;
            dir    = theDir;
            vel    = theVel;

            theOneWhoFiredMe.Set(theSource.currentLocation, source);
            position.Value        = source.getStandingPosition();
            position.X           += source.GetBoundingBox().Width;
            position.Y           += source.GetBoundingBox().Height;
            rotation              = theDir;
            xVelocity.Value       = (float)Math.Cos(dir) * vel;
            yVelocity.Value       = (float)Math.Sin(dir) * vel;
            damagesMonsters.Value = true;

            tex   = Content.loadTexture("magic/" + spell.ParentSchoolId + "/" + spell.Id + "/projectile.png");
            texId = Content.loadTextureKey("magic/" + spell.ParentSchoolId + "/" + spell.Id + "/projectile.png");
        }
Exemplo n.º 8
0
    public override void TriggerWildcardAttack(WeaponEnum weaponMod)
    {
        ProjectileSpell spell = AbilityHandler.Instance.Attack.Spell as ProjectileSpell;
        float           additionalCritChance = _tierStats[Tier - 1].CritChance;

        switch (weaponMod)
        {
        case WeaponEnum.barrel:
            spell.CritChance = spell.BaseCritChance + additionalCritChance;
            break;

        case WeaponEnum.blade:
            spell.CritChance = spell.BaseCritChance + additionalCritChance;
            break;

        case WeaponEnum.magiccore:
            spell.CritChance = spell.BaseCritChance + additionalCritChance;
            break;

        case WeaponEnum.neutral:
            break;
        }
    }
Exemplo n.º 9
0
        public ScriptableObject createSpell()
        {
            System.Random rand = new System.Random();
            int           alea = 1;

            switch (alea)
            {
            case 1:
                ProjectileSpell feu = ScriptableObject.CreateInstance <ProjectileSpell>();
                feu.degats          = 15;
                feu.description     = "Lance une boule de feu";
                feu.cooldown        = 5;
                feu.projectileSpeed = 400;
                feu.duree           = 0;
                feu.element         = "feu";
                feu.nomSort         = "boule de feu";
                feu.sprite          = Resources.Load <Sprite>("UIskills/red (14)");
                feu.prefab          = Resources.Load <GameObject>("PrefabSpell/BouleDeFeu");
                return(feu);

            default:
                throw new Exception("Cet objet n'existe pas");
            }
        }
Exemplo n.º 10
0
        public ISpell CreateSpell(IWizard caster)
        {
            ISpell spell = new ProjectileSpell();

            return(spell);
        }
 public ProjectileShootTriggerable(ProjectileSpell spell)
 {
     m_spell = spell;
 }