public void Enter(Enemies.Enemy enemy, EnemyData data)
        {
            _enemy = enemy;

            enemy.SetMovementSpeed(data.speed * 2);
            IsEnemyJumping(true);
        }
Beispiel #2
0
        public void Enter(Enemies.Enemy enemy, EnemyData data)
        {
            _enemy             = enemy;
            _enemyHealth       = _enemy.EnemyHealth;
            _anim              = enemy.MyAnimator;
            _remainingCooldown = 0;
            _enemyData         = data;

            enemy.SetMovementSpeed(0);
        }
Beispiel #3
0
        //Constructor for bomb class
        public Bomb(Vector2 startingLoc, Enemies.Enemy targetEnemy) : base(startingLoc, targetEnemy)
        {
            //Setting up image and rectangle for bomb projectile
            img  = ProjectileResources.bombImg;
            rect = new Rectangle((int)(startingLoc.X - 12), (int)(startingLoc.Y - 12), 25, 25);

            //Setting up and playing bomb soundeffect
            sndInstance        = ProjectileResources.bomberSnd.CreateInstance();
            sndInstance.Volume = Driver.Main.actualVolume[1];
            sndInstance.Play();
        }
Beispiel #4
0
        //Constructor for cannon ball class
        public CannonBall(Vector2 startingLoc, Enemies.Enemy targetEnemy) : base(startingLoc, targetEnemy)
        {
            //Setting up image and rectangle for cannonball projectile
            img  = ProjectileResources.cannonBallImg;
            rect = new Rectangle((int)(startingLoc.X - 7), (int)(startingLoc.Y - 7), 15, 15);

            //Setting up and playing cannonball soundeffect
            sndInstance        = ProjectileResources.cannonSnd.CreateInstance();
            sndInstance.Volume = Driver.Main.actualVolume[1];
            sndInstance.Play();
        }
        //Constructor for projectile class
        public Projectile(Vector2 startingLoc, Enemies.Enemy targetEnemy)
        {
            //Setting locations vectors and rectangle
            this.startingLoc = startingLoc;
            currentLoc       = startingLoc;
            this.targetEnemy = targetEnemy;

            //Calculating future location of target enemy and velocity
            int directionHolder;

            endingLoc  = Enemies.Enemy.GetCenterLocation(targetEnemy.relativePos + targetEnemy.speed * TRAVEL_TIME / Driver.GameLogic.currentSpeed * 60, out directionHolder);
            velocity.X = (float)((endingLoc.X - startingLoc.X) * Driver.GameLogic.currentSpeed / TRAVEL_TIME);
            velocity.Y = (float)((endingLoc.Y - startingLoc.Y) * Driver.GameLogic.currentSpeed / TRAVEL_TIME);
        }
Beispiel #6
0
        //Constructor for arrow class
        public Arrow(Vector2 startingLoc, Enemies.Enemy targetEnemy) : base(startingLoc, targetEnemy)
        {
            //Setting up image and rectangle for arrow projectile
            img  = ProjectileResources.arrowImg;
            rect = new Rectangle((int)(startingLoc.X - 17), (int)(startingLoc.Y - 7), 35, 15);

            //Calculating arrow rotation
            sourceRect = new Rectangle(rect.X + 17, rect.Y + 7, 35, 15);
            direction  = startingLoc - targetEnemy.centerLoc;
            rotation   = (float)Math.Atan2(direction.Y, direction.X);

            //Setting up and playing fireball soundeffect
            sndInstance        = ProjectileResources.archerSnd.CreateInstance();
            sndInstance.Volume = Driver.Main.actualVolume[1];
            sndInstance.Play();
        }
Beispiel #7
0
 public Bullet(int dmg, int spd, bool isFlying, bool isGround, bool isHoming, bool isPiercing, int x, int y, Texture2D sprite, int w, int h, Enemies.Enemy t)
 {
     flying = isFlying;
     ground = isGround;
     homing = isHoming;
     piercing = isPiercing;
     power = dmg;
     speed = spd;
     width = w;
     height = h;
     image = sprite;
     position = new Vector2(x,y);
     target = t;
     objectPosition = t.getPos();
     angleChange(objectPosition);
     isDead = false;
 }
Beispiel #8
0
 /// <summary>
 /// Deals given damage to given enemy
 /// </summary>
 /// <param name="anEnemy"></param>
 public void DealDamage(Enemies.Enemy anEnemy, float aDamage, bool ShouldBeStunned, int aSpellIndex = 0) => anEnemy.TakeDamage(aDamage, aSpellIndex > 0 ? myIntelligence : myStrength + myTempStrength, ShouldBeStunned, aSpellIndex);