Ejemplo n.º 1
0
        public void AddProjectile(eProjectile projectileType, Vector2 location, Vector2 direction, Player owner, int texIdx, Color drawColor, int tier)
        {
            BaseProjectile p = ProjectilePool[ProjectilePool.Count - 1];

            p.Initialize(projectileType, location, direction, owner, texIdx, tier);
            p.DrawColor = drawColor;
            Entities.Add(p);
            ProjectilePool.Remove(p);
        }
Ejemplo n.º 2
0
        public BaseProjectile(Vector2 centerLocation, eProjectile projectileType, bool isTowerProjectile, ITargetable target, float damage, eDamageType damageType, int splash, int splashDmgPerc, int impactFX)
        {
            EntityID = Engine.RetrieveNextEntityID();
            switch (projectileType)
            {
            case eProjectile.None:
                throw new Exception("Trying to create a bullet with eProjectile.None.");

            case eProjectile.TestBullet1:
                Texture  = Textures[0];
                Velocity = 6f;
                break;

            case eProjectile.CannonBall16:
                Texture  = Textures[1];
                Velocity = 6f;
                break;

            case eProjectile.CannonBall32:
                Texture  = Textures[2];
                Velocity = 6f;
                break;

            default:
                throw new CaseStatementMissingException();
            }
            FeetOffset = new Vector2(Texture.Width / 2, Texture.Height);

            if (isTowerProjectile)
            {
                EntityType = eEntityType.TowerProjectile;
            }
            else
            {
                EntityType = eEntityType.RunnerProjectile;
            }

            Target     = target;
            Damage     = damage;
            DamageType = damageType;

            Splash        = splash;
            SplashDmgPerc = splashDmgPerc;
            Location      = centerLocation - new Vector2(Texture.Width / 2, Texture.Height / 2);
            ImpactFX      = impactFX;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Melee constructor
 /// </summary>
 /// <param name="range"></param>
 /// <param name="attackDelay"></param>
 /// <param name="damage"></param>
 /// <param name="projectileType"></param>
 /// <param name="splash"></param>
 /// <param name="splashDmgPerc"></param>
 public WeaponStruct(int range, int attackDelay, float damage, int splash, int splashDmgPerc, eAttackableTargets attackableTargets)
 {
     Range                 = range;
     AttackDelay           = attackDelay;
     CritChance            = 0;
     CritMultiplier        = 2;
     Damage                = damage;
     ProjectileType        = eProjectile.None;
     Splash                = splash;
     SplashDmgPerc         = splashDmgPerc;
     IsMelee               = true;
     AttackableTargets     = attackableTargets;
     ProjectileSpawnOffset = Common.InvalidVector2;
     DamageType            = eDamageType.Normal;
     ShootFX               = ImpactFX = -1;
     WeaponModifiers       = new WeaponModifiers();
 }
    //This function fires projectiles at any unit
    void Attack(GameObject closest)
    {
        GameObject  rockGO = Instantiate(rockPrefab, this.transform.position, this.transform.rotation);
        eProjectile br     = rockGO.GetComponent <eProjectile>();

        if (closest == null)
        {
            anim.SetBool("Moving", true);
            anim.SetBool("Attacking", false);

            assaultMode   = true;
            attackMode    = false;
            attackingBase = false;
            Destroy(rockGO);
        }
        br.target  = closest.transform;
        fireCDLeft = fireCD;
    }
Ejemplo n.º 5
0
 //public BaseWeapon(Vector2 centerLoc, int atkDelayInMS, float damage, int range, int critRate, int critMultiplier, int splash, int splashDmgPerc, eProjectile projectileType, IHaveTarget owner, Vector2 projectileSpawnOffset)
 public BaseWeapon(Vector2 centerLoc, WeaponStruct ws, IHaveTarget owner)
 {
     CenterLocation        = centerLoc;
     RoF                   = new SimpleTimer(ws.AttackDelay);
     Damage                = ws.Damage;
     DamageType            = ws.DamageType;
     Range                 = ws.Range;
     CritRate              = ws.CritChance;
     CritMultiplier        = ws.CritMultiplier;
     Splash                = ws.Splash;
     SplashDmgPerc         = ws.SplashDmgPerc;
     ProjectileType        = ws.ProjectileType;
     Owner                 = owner;
     ProjectileSpawnOffset = ws.ProjectileSpawnOffset;
     ShootFX               = ws.ShootFX;
     ImpactFX              = ws.ImpactFX;
     if (ws.Range >= 96)
     {
         IsRanged = true;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="projectileType"></param>
        /// <param name="location"></param>
        /// <param name="direction"></param>
        /// <param name="owner"></param>
        /// <param name="texIdx"></param>
        /// <param name="tier"></param>
        /// <param name="dmgMod">1 means 100%, 1.5 means 150%, etc.</param>
        public void Initialize(eProjectile projectileType, Vector2 location, Vector2 direction, Player owner, int texIdx, int tier)
        {
            IsDisposed     = false;
            ProjectileType = projectileType;
            DrawColor      = Color.White;
            switch (ProjectileType)
            {
            case eProjectile.Round:
                AABB = new Rectangle(location.Xi(), location.Yi(), 16, 16);
                if (owner == null)
                {
                    Animation = RoundTexture;
                    Velocity  = 9f;
                    Damage    = 5;
                }
                else
                {
                    if (tier == 1)
                    {
                        Animation = RoundTexture;
                        Velocity  = 16f;
                        Damage    = 10;
                    }
                    else
                    {
                        Animation = RoundTextureT2;
                        Velocity  = 20f;
                        Damage    = 15;
                    }
                }
                break;

            case eProjectile.Boom1Enemy:
                AABB = new Rectangle(location.Xi(), location.Yi(), 18, 24);
                if (owner == null)
                {
                    Animation = Boom1Texture;
                    Velocity  = 6.5f;
                    Damage    = 15;
                }
                else
                {
                    if (tier == 1)
                    {
                        Animation = Boom1TexturePlayer;
                        Velocity  = 6.5f;
                        Damage    = 15;
                    }
                    else
                    {
                        Animation = Boom1TexturePlayerT2;
                        Velocity  = 7f;
                        Damage    = 22;
                    }
                }
                break;

            case eProjectile.Missile:
                AABB     = new Rectangle(location.Xi(), location.Yi(), 18, 23);
                Velocity = 7.3f;
                if (owner == null)
                {
                    Animation = MissileEnemyTexture;
                    Damage    = 10;
                }
                else
                {
                    if (tier == 1)
                    {
                        Animation = MissileTexture;
                        Damage    = 10;
                    }
                    else
                    {
                        Animation = MissileTextureT2;
                        Damage    = 20;
                    }
                }
                break;

            case eProjectile.MG1:
                Animation = MG1Textures[texIdx];
                AABB      = new Rectangle(location.Xi(), location.Yi(), 8, 8);
                Velocity  = 9f;
                Damage    = 2;
                break;

            case eProjectile.MG2:
                Animation = MG2Textures[texIdx];
                AABB      = new Rectangle(location.Xi(), location.Yi(), 8, 8);
                Velocity  = 10f;
                Damage    = 3.2f;
                break;

            case eProjectile.MissileM45:
                AABB     = new Rectangle(location.Xi(), location.Yi(), 24, 22);
                Velocity = 7f;
                if (owner == null)
                {
                    Animation = MissileM45Texture;
                    Damage    = 10;
                }
                else
                {
                    if (tier == 1)
                    {
                        Animation = Missile45PlayerTexture;
                        Damage    = 10;
                    }
                    else
                    {
                        Animation = Missile45PlayerT2Texture;
                        Damage    = 20;
                    }
                }
                break;

            case eProjectile.Missile45:
                AABB     = new Rectangle(location.Xi(), location.Yi(), 23, 23);
                Velocity = 7f;
                if (owner == null)
                {
                    Animation = Missile45Texture;
                    Damage    = 10;
                }
                else
                {
                    if (tier == 1)
                    {
                        Animation = MissileM45PlayerTexture;
                        Damage    = 10;
                    }
                    else
                    {
                        Animation = MissileM45PlayerT2Texture;
                        Damage    = 20;
                    }
                }
                break;

            default:
                throw new CaseStatementMissingException();
            }

            Location  = location;
            Direction = direction;
            Direction.Normalize();
            Owner           = owner;
            MoveIncrementer = Velocity * Direction;
            if (Owner != null)
            {
                Damage *= owner.DmgMod;
            }
        }