/// <summary> /// Turn the shield on. /// /// Currently just draws the sheild. The sheild resources are handled in PlayerCharacter and CharcaterEntity. /// This may change in the future. /// </summary> /// <param name="gameReference">A reference so we can see where everything is.</param> /// <param name="holder">A reference to the character holding the weapon.</param> public override void activate(Pantheon gameReference, CharacterEntity holder) { base.activate(gameReference, holder); shieldOn = !shieldOn; }
/// <summary> /// The super ambiguous function designed to be super ambiguous. /// /// Basically, call this function for some random object to do some /// random thing. /// /// See? Super ambiguous. /// </summary> /// <param name="gameReference">A supremely useful reference to everything, just in case you need it.</param> /// <param name="holder">A reference to the character holding the weapon.</param> public virtual void activate(Pantheon gameReference, CharacterEntity holder) { //gameReference.audioManager.playSoundEffect(soundCueName); }
/// <summary> /// The super ambiguous function designed to be super ambiguous. /// /// Basically, call this function for some random object to do some /// random thing. /// /// See? Super ambiguous. /// </summary> /// <param name="gameReference">A supremely useful reference to everything, just in case you need it.</param> /// <param name="holder">A reference to the character holding the weapon.</param> public virtual void activate(Pantheon gameReference, CharacterEntity holder) { }
/// <summary> /// Shoots a bullet. /// </summary> /// <param name="gameReference">A reference to the entire game thiny.</param> /// <param name="holder">A reference to the holder character.</param> private void shootABullet(Pantheon gameReference, CharacterEntity holder) { Bullet bullet = new Bullet(holder.Location + new Vector2((float)(41*Math.Cos(holder.AngleFacing)), (float)(41*Math.Sin(holder.AngleFacing))), 41, holder.AngleFacing, range, damage, gameReference); bullet.Load(gameReference.Content); gameReference.currentLevel.addList.Add("bullet_" + Bullet.NextId, bullet); //Drain a bullet from the current ammo currentAmmo--; }
/// <summary> /// Shoot the weapon. That's what this game is really about, right? /// /// Also, we need to rethink the way that shooting works right now. Eventually, I think that the /// Character Entity class needs an aiming point. This makes it so both Enemies and Players can use /// weapons. /// </summary> /// <param name="gameReference">A reference so we can see where everything is.</param> /// <param name="holder">A reference to the character holding the weapon.</param> public override void activate(Pantheon gameReference, CharacterEntity holder) { base.activate(gameReference, holder); //Shoot when the cool down has lasted long enough. if(lastShot.CompareTo(TimeSpan.Zero) <= 0 && currentAmmo > 0) { shootABullet(gameReference, holder); lastShot = TimeSpan.FromMilliseconds(1000/ fireRate); } }
/// <summary> /// Shoots a bullet. /// </summary> /// <param name="gameReference">A reference to the entire game thiny.</param> /// <param name="holder">A reference to the holder character.</param> private void shootABullet(Pantheon gameReference, CharacterEntity holder) { Bullet bullet = new Bullet(new Vector2(holder.DrawingBox.Center.X, holder.DrawingBox.Center.Y) + new Vector2((float)(72*Math.Cos(holder.AngleFacing)), (float)(72*Math.Sin(holder.AngleFacing))), speed, holder.AngleFacing, range, damage, gameReference); bullet.Load(gameReference.Content, bulletType); gameReference.currentLevel.addList.Add("bullet_" + Bullet.NextId, bullet); gameReference.audioManager.playSoundEffect(this.soundCueName); //Drain a bullet from the current ammo currentAmmo--; }