Enemies die when shot, also, rockets with R
This commit is contained in:
@@ -205,13 +205,17 @@ namespace DepthsBelow
|
||||
{
|
||||
|
||||
}
|
||||
if (ks.IsKeyDown(Keys.S))
|
||||
if (ks.IsKeyDown(Keys.S) || ks.IsKeyDown(Keys.R))
|
||||
{
|
||||
foreach (var soldier in core.Squad)
|
||||
{
|
||||
if (soldier.Selected == true && soldier.Fired == false)
|
||||
{
|
||||
if (ks.IsKeyDown(Keys.S)) {
|
||||
core.Volley.Add(new Shot(core.EntityManager, soldier.GetComponent<Component.Stat>(), "Bullet"));
|
||||
} else if (ks.IsKeyDown(Keys.R)) {
|
||||
core.Volley.Add(new Shot(core.EntityManager, soldier.GetComponent<Component.Stat>(), "Rocket"));
|
||||
}
|
||||
soldier.Fired = true;
|
||||
foreach (var shot in core.Volley)
|
||||
{
|
||||
|
||||
@@ -41,13 +41,14 @@ namespace DepthsBelow
|
||||
public Shot(EntityManager entityManager, Stat _soldierStat, string _type)
|
||||
: base(entityManager)
|
||||
{
|
||||
type = _type;
|
||||
|
||||
if (Texture == null)
|
||||
LoadContent();
|
||||
|
||||
Transform.World.Origin = new Vector2(16, 16);
|
||||
|
||||
Stat = _soldierStat;
|
||||
type = _type;
|
||||
|
||||
this.Color = Color.White;
|
||||
var rc = new SpriteRenderer(this) { Texture = Texture, Color = Color.White };
|
||||
@@ -85,7 +86,7 @@ namespace DepthsBelow
|
||||
{
|
||||
if (this.GetComponent<Component.Collision>().Rectangle.Intersects(entity.GetComponent<Component.Collision>().Rectangle))
|
||||
{
|
||||
if (Utility.HitTest(Stat, entity, Utility.CalculateHitChance(Stat, this.Stat.Remember, entity)))
|
||||
if (Utility.AttackTest(Stat, entity, Utility.CalculateHitChance(Stat, this.Stat.Remember, entity)))
|
||||
{
|
||||
this.Remove();
|
||||
return;
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace DepthsBelow
|
||||
{
|
||||
if (entity.GetComponent<Component.Collision>().Rectangle.Intersects(this.GetComponent<Component.Collision>().Rectangle))
|
||||
{
|
||||
if (Utility.HitTest(this.GetComponent<Component.Stat>(), entity, Utility.CalculateHitChance(this.GetComponent<Component.Stat>(), this.Transform.World.Position, entity)))
|
||||
if (Utility.AttackTest(this.GetComponent<Component.Stat>(), entity, Utility.CalculateHitChance(this.GetComponent<Component.Stat>(), this.Transform.World.Position, entity)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace DepthsBelow
|
||||
//Console.WriteLine(chanceToHit);
|
||||
return chanceToHit;
|
||||
}
|
||||
public static bool HitTest(Stat attacker, Entity defender, int chanceToHit)
|
||||
public static bool AttackTest(Stat attacker, Entity defender, int chanceToHit)
|
||||
{
|
||||
Component.Stat shooting = attacker;
|
||||
Component.Stat dodging = defender.GetComponent<Component.Stat>();
|
||||
|
||||
Reference in New Issue
Block a user