Esempio n. 1
0
        public override void Attack()
        {
            if (waitTimer >= 0)
            {
                if (waitTimer <= 0)
                {
                    if (this.AttackType == AttackType.Ranged)
                    {
                        thought = new SearchAndDestroy(this, Avatar.Instance(), 500, 150);
                    }
                    else
                    {
                        thought = new SearchAndDestroy(this, Avatar.Instance(), 500, 50);
                    }
                }
                waitTimer--;
                return;
            }
            attackTimer++;

            kinetics.velocity = Vector2.Zero;
            kinetics.orientations.SetOrientation(Movement.Orientate(kinetics, Avatar.Instance().kinetics, 60));

            if (attackTimer > 20)
            {
                if (this.AttackType == AttackType.Melee)
                {
                    current = attack;
                    if (current.Finished())
                    {
                        DamageBox damageBox = new DamageBox(kinetics.position + kinetics.orientations.GetVecOrientation() * 3, kinetics.orientations.GetVecOrientation(), kinetics.orientations.GetVecOrientation(), 30, false);
                        LevelManager.Instance().getCurrentLevel().InsertGameObject(damageBox);
                        SoundManager.Instance().AddSound(new SFX("SFX\\swing"));
                        attackTimer = 0;
                        current.Reset();
                        current   = walk;
                        waitTimer = 20;
                    }
                }

                if (this.AttackType == AttackType.Ranged)
                {
                    FireBall damageBox = new FireBall(kinetics.position + kinetics.orientations.GetVecOrientation() * 3, kinetics.orientations.GetVecOrientation() * 10, 30, false);
                    LevelManager.Instance().getCurrentLevel().InsertGameObject(damageBox);
                    SoundManager.Instance().AddSound(new SFX("SFX\\fireball"));
                    attackTimer = 0;
                    if (current.Finished())
                    {
                        current.Reset();
                        current   = walk;
                        waitTimer = 20;
                    }
                }
            }
        }
Esempio n. 2
0
        public override void Attack()
        {
            if (ControllerInput.Instance().GetButton(Buttons.X).Pressed&& !Magic ||
                ControllerInput.Instance().GetKey(Keys.X).Pressed&& !Magic)
            {
                DamageBox temp = new DamageBox(kinetics.position + kinetics.orientations.GetVecOrientation() * 100, Vector2.Zero, 3, true);
                LevelManager.Instance().getCurrentLevel().InsertGameObject(temp);
                SoundManager.Instance().AddSound(new SFX("SFX\\swing"));
                Melee            = true;
                currentAnimation = attack;
                currentAnimation.Reset();
            }

            if (ControllerInput.Instance().GetButton(Buttons.RightShoulder).Pressed)
            {
                still = !still;
            }

            if (still)
            {
                if (kinetics.velocity != Vector2.Zero)
                {
                    kinetics.orientations.SetOrientation(kinetics.velocity);
                    kinetics.velocity = Vector2.Zero;
                }
            }


            if (ControllerInput.Instance().GetButton(Buttons.RightTrigger).Held&& !Melee ||
                ControllerInput.Instance().GetKey(Keys.Z).Pressed&& !Melee)
            {
                still = true;
                if (timer > 15)
                {
                    FireBall fireBall = new FireBall(kinetics.position, kinetics.orientations.GetVecOrientation() * 30, 30, true);
                    LevelManager.Instance().getCurrentLevel().InsertGameObject(fireBall);
                    SoundManager.Instance().AddSound(new SFX("SFX\\fireball"));
                    Magic            = true;
                    currentAnimation = magic;
                    currentAnimation.Reset();
                    timer = 0;
                }
                else
                {
                    timer++;
                }
            }
            if (ControllerInput.Instance().GetButton(Buttons.RightTrigger).Released)
            {
                timer = 15;
                still = false;
            }
        }
Esempio n. 3
0
        public override void Attack()
        {
            kinetics.velocity = Vector2.Zero;
            kinetics.orientations.SetOrientation(Movement.Orientate(kinetics, Avatar.Instance().kinetics, 60));
            if (attackTimer.Ready())
            {
                FireBall fireBall = new FireBall(kinetics.position, kinetics.orientations.GetVecOrientation() * 10, 30, false);
                LevelManager.Instance().getCurrentLevel().InsertGameObject(fireBall);
                SoundManager.Instance().AddSound(new SFX("SFX\\fireball"));
                attackTimer.Reset();

                thought = new SearchAndDestroy(this, Avatar.Instance());
            }
        }
Esempio n. 4
0
 public override void CollisionResolution(GameObject Item)
 {
     if (Item.GetType().Equals(typeof(Avatar)))
     {
     }
     if (Item.GetType().Equals(typeof(FireBall)))
     {
         FireBall temp = Item as FireBall;
         if (temp.Friendly())
         {
             SoundManager.Instance().AddSound(new SFX("SFX\\explosion"));
             this.HP = -1;
         }
     }
 }
Esempio n. 5
0
        public override void CollisionResolution(GameObject Item)
        {
            if (Item.GetType().Equals(typeof(DamageBox)))
            {
                DamageBox temp = Item as DamageBox;
                if (!temp.Friendly())
                {
                    SoundManager.Instance().AddSound(new SFX("SFX\\explosion"));
                    kinetics.ApplyForce(temp.kinetics.orientations.GetVecOrientation() * 30);
                }
            }

            if (Item.GetType().Equals(typeof(FireBall)))
            {
                FireBall temp = Item as FireBall;
                if (!temp.Friendly())
                {
                    SoundManager.Instance().AddSound(new SFX("SFX\\explosion"));
                }
            }
        }
Esempio n. 6
0
 public override void CollisionResolution(GameObject Item)
 {
     if (Item.GetType().Equals(typeof(Avatar)))
     {
     }
     if (Item.GetType().Equals(typeof(FireBall)))
     {
         FireBall temp = Item as FireBall;
         if (temp.Friendly())
         {
             SoundManager.Instance().AddSound(new SFX("SFX\\explosion"));
             float test = Vector2.Dot(kinetics.orientations.GetVecOrientation(), temp.kinetics.orientations.GetVecOrientation());
             if (test < 0)
             {
                 HP -= 1;
             }
             else
             {
                 HP = 0;
             }
         }
     }
 }
Esempio n. 7
0
        public override void Attack()
        {
            if (ControllerInput.Instance().GetButton(Buttons.X).Pressed&& !Magic ||
                ControllerInput.Instance().GetKey(Keys.X).Pressed&& !Magic)
            {
                DamageBox temp = new DamageBox(kinetics.position + kinetics.orientations.GetVecOrientation() * 100, kinetics.orientations.GetVecOrientation(), Vector2.Zero, 3, true);
                LevelManager.Instance().getCurrentLevel().InsertGameObject(temp);
                SoundManager.Instance().AddSound(new SFX("SFX\\swing"));
                Melee            = true;
                currentAnimation = attack;
                currentAnimation.Reset();
            }

            if (ControllerInput.Instance().GetButton(Buttons.B).Pressed&& !Melee ||
                ControllerInput.Instance().GetKey(Keys.Z).Pressed&& !Melee)
            {
                FireBall fireBall = new FireBall(kinetics.position, kinetics.orientations.GetVecOrientation() * 30, 30, true);
                LevelManager.Instance().getCurrentLevel().InsertGameObject(fireBall);
                SoundManager.Instance().AddSound(new SFX("SFX\\fireball"));
                Magic            = true;
                currentAnimation = magic;
                currentAnimation.Reset();
            }
        }