public override void Throw() { base.Throw(); blob.RemoveComponent <Damage>(); velocity = VectorFacing.RotateVectorToFacing(velocity, body.GetFacing()); storedCharge = chargePower + (IsSweet()?sweetBonus:0); }
public override void Throw() { base.Throw(); velocity = VectorFacing.RotateVectorToFacing(velocity, body.GetFacing()); body.movement.velocity += -velocity * 5; SoundManager.PlaySound(SoundManager.SFX_ROCKET_BLAST); }
public override void Start() { base.Start(); damageComp = new Damage(damage, piercing); damageComp.relativeKnockbackCollider = relativeCollider; damageComp.knockbackPower = knockback; Sprite sprite = new Sprite(ResourceManager.hitFlash); sprite.SetAnchor(Sprite.AnchorType.Middle_Center); float rotation = VectorFacing.FacingToPi(face); sprite.rotation = rotation; FadeInSeconds fade = new FadeInSeconds(duration * 1.6f); Collider collider = new Collider(); collider.bounds = new Rectangle(0, 0, sprite.width, sprite.height); collider.offset = new Vector2(-sprite.origin.X, -sprite.origin.Y); this.blob.AddComponent(damageComp); this.blob.AddComponent(sprite); this.blob.AddComponent(collider); this.blob.AddComponent(fade); timer = duration; }
public void FireGun() { if (ammo > 0 && hasBeenUnpressed) { Blob bulletBlob = new Blob(); bulletBlob.transform.Position = blob.transform.Position; Sprite headSprite = new Sprite(ResourceManager.bullet); bulletBlob.AddComponent(headSprite); Collider collider = new Collider(); collider.bounds = ResourceManager.GetBounds(headSprite.texture); collider.offset = new Vector2(collider.bounds.X, collider.bounds.Y); bulletBlob.AddComponent(collider); bulletBlob.AddComponent(new Damage(DamageValues.throwDamage, DamageValues.gunLegPiercing)); bulletBlob.AddComponent(new DieOutOfBounds()); SoundManager.PlaySound(SoundManager.SFX_GUN_LEG_SHOT); if (!thrown) { facing = body.GetFacing(); } bulletBlob.AddComponent(new Bullet(VectorFacing.RotateVectorToFacing(bulletFireTrajectory, facing))); ammo--; } else if (ammo <= 0 && hasBeenUnpressed) { SoundManager.PlaySound(SoundManager.SFX_EMPTY_GUN); } }
public void IncreaseCharge() { chargePower += chargeSpeed * Time.deltaTime; chargePower = MathHelper.Min(chargePower, chargeMax); GameManager.Instance.SetSecondLabel(chargePower.ToString("0.00")); Vector2 chargeTranslationVector = VectorFacing.RotateVectorToFacing(chargeMove, body.GetFacing()); offset = chargeTranslationVector * (chargePower / chargeMax); blob.transform.LocalPosition = offset + currentAnchor; }
public override void Throw() { base.Throw(); velocity = VectorFacing.RotateVectorToFacing(velocity, body.GetFacing()); if (IsSweet()) { GameManager.Instance.SetSecondLabel("SWEET SHOT"); } velocity *= chargePower + (IsSweet() ? sweetBonus : 0f); }
public override void EndPunch() { if (chargePower >= sweetMin) { Blob b = new Blob(); b.AddComponent(new HitFlash(DamageValues.humanMelee + (chargePower == chargeMax?1:0), 0f, body.GetFacing(), DamageValues.humanPiercing, body.Collider)); Vector2 position = VectorFacing.RotateVectorToFacing(new Vector2(0, 50), body.GetFacing()); b.transform.Position = body.GetColliderCenter() + position + new Vector2(0, -20); SoundManager.PlaySound(SoundManager.SFX_PUNCH); } }
public override void EndPunch() { //TODO nick tweak pubch attack if (chargePower > 0 && ammo-- >= 0) { //make an attack Blob b = new Blob(); b.AddComponent(new HitFlash(DamageValues.robotMelee, 20f, body.GetFacing(), DamageValues.robotPiercing, body.Collider)); Vector2 position = VectorFacing.RotateVectorToFacing(new Vector2(0, 50), body.GetFacing()); b.transform.Position = body.GetColliderCenter() + position + new Vector2(0, -20); SoundManager.PlaySound(SoundManager.SFX_PUNCH); } }
public override void EndPunch() { if (chargePower > 0 && ammo-- >= 0) { Blob b = new Blob(); b.AddComponent(new HitFlash(DamageValues.robotMelee, 20f, body.GetFacing(), DamageValues.robotPiercing, body.Collider)); b.transform.Parent = this.blob.transform; Vector2 position = VectorFacing.RotateVectorToFacing(new Vector2(0, 50), body.GetFacing()); b.transform.LocalPosition = position + new Vector2(25, 0); SoundManager.PlaySound(SoundManager.SFX_PUNCH); } }
public override void ThrowUpdate() { throwTime += Time.deltaTime; if (throwTime > maxThrowTime) { velocity *= .75f; FadeAway(); } blob.transform.Translate(velocity * Time.deltaTime); float acceleration = 200; double rotateSpeed = Math.PI * 10; float angleChange = (float)((random.NextDouble() - .5) * rotateSpeed); velocity += Vector2.Normalize(velocity) * acceleration * Time.deltaTime; velocity = VectorFacing.RotateVector(velocity, angleChange * Time.deltaTime); }
public override void EndPunch() { if (chargePower >= .7) { //make an attack int damage = IsSweet() ? 2 : 1; Blob b = new Blob(); b.AddComponent(new HitFlash(DamageValues.humanArm * damage, 50f, body.GetFacing(), DamageValues.humanPiercing, body.Collider)); b.transform.Parent = this.blob.transform; Vector2 position = VectorFacing.RotateVectorToFacing(new Vector2(0, 50), body.GetFacing()); b.transform.LocalPosition = position + new Vector2(25, 0); SoundManager.PlaySound(SoundManager.SFX_PUNCH); chargeSpeed -= .5f; } }
public override void Throw() { base.Throw(); velocity = VectorFacing.RotateVectorToFacing(velocity, body.GetFacing()); if (IsSweet()) { GameManager.Instance.SetSecondLabel("SWEET SHOT"); } SoundManager.PlaySound(SoundManager.SFX_RIP_HUMAN_LIMB); Blob blood = new Blob(); blood.AddComponent(new Sprite(ResourceManager.Blood)); blood.transform.Position = this.blob.transform.Position; blood.GetComponent <Sprite>().SetAnchor(Sprite.AnchorType.Upper_Left); blood.GetComponent <Sprite>().z = 0.99f; blood.GetComponent <Sprite>().scale = 0.5f; velocity *= chargePower + (IsSweet() ? sweetBonus : 0f); }
public override void Throw() { base.Throw(); Facing fireFacing = body.GetFacing(); if (limbType == LimbType.LeftArm || limbType == LimbType.LeftLeg) { fireFacing = VectorFacing.FacingTurnFacing(body.GetFacing(), Facing.Left); } else if (limbType == LimbType.RightArm || limbType == LimbType.RightLeg) { fireFacing = VectorFacing.FacingTurnFacing(body.GetFacing(), Facing.Right); } velocity = VectorFacing.RotateVectorToFacing(velocity, body.GetFacing()); facing = fireFacing; if (IsSweet()) { GameManager.Instance.SetSecondLabel("SWEET SHOT"); } velocity *= chargePower + (IsSweet()?sweetBonus:0f); }
public override void EndPunch() { body.movement.velocity += -DamageValues.rocketKick * VectorFacing.RotateVectorToFacing(velocity, body.GetFacing()); }
public void FireGun(Vector2 position) { if (ammo > 0 && hasBeenUnpressed) { if (!thrown) { facing = body.GetFacing(); } chargePower = Math.Max(chargePower, 1); int laserWidth = (int)(60 * chargePower); Blob bulletBlob = new Blob(); bulletBlob.transform.Position = position; Sprite laserSprite = new Sprite(ResourceManager.laserBeam); //laserSprite.SetAnchor(Sprite.AnchorType.Upper_Center); laserSprite.rotation = VectorFacing.FacingToPi(facing); laserSprite.SetSize(laserWidth * 2, 1000); bulletBlob.AddComponent(laserSprite); Collider collider = new Collider(); bulletBlob.AddComponent(collider); laserWidth /= 2; Rectangle colliderRectangle = new Rectangle(); switch (facing) { case Facing.Down: colliderRectangle = new Rectangle(0, 0, laserWidth, 1000); collider.offset = new Vector2(laserWidth * 1.5f, 0); bulletBlob.transform.Translate(new Vector2(-laserWidth * 2, 0)); break; case Facing.Left: colliderRectangle = new Rectangle(0, 0, 1000, laserWidth); collider.offset = new Vector2(-1000, laserWidth * 1.5f); bulletBlob.transform.Translate(new Vector2(0, -laserWidth * 2)); break; case Facing.Right: colliderRectangle = new Rectangle(0, 0, 1000, laserWidth); collider.offset = new Vector2(0, -laserWidth * 2.5f); bulletBlob.transform.Translate(new Vector2(0, laserWidth * 2)); break; case Facing.Up: colliderRectangle = new Rectangle(0, 0, laserWidth, 1000); collider.offset = new Vector2(-laserWidth * 2.5f, -1000); bulletBlob.transform.Translate(new Vector2(laserWidth * 2, 0f)); break; } collider.bounds = colliderRectangle; float dieTime = .3f * chargePower; bulletBlob.AddComponent(new DieInSeconds(dieTime)); bulletBlob.AddComponent(new FadeInSeconds(dieTime)); bulletBlob.AddComponent(new Damage(5)); bulletBlob.AddComponent(new DieOutOfBounds()); //bulletBlob.AddComponent(new Bullet(VectorFacing.RotateVectorToFacing(bulletFireTrajectory, facing))); ammo--; SoundManager.PlaySound(SoundManager.SFX_LASER_FIRE); } else if (ammo <= 0 && hasBeenUnpressed) { SoundManager.PlaySound(SoundManager.SFX_EMPTY_GUN); } }