Moved DrawLine from RenderHelpers to Utility.
This commit is contained in:
@@ -69,13 +69,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
// TODO: Add your initialization logic here
|
// TODO: Add your initialization logic here
|
||||||
EntityManager = new EntityManager();
|
EntityManager = new EntityManager();
|
||||||
|
TurnManager = new TurnManager(new string[] { "Player", "Computer" });
|
||||||
TurnManager = new TurnManager(new string[] { "Player", "Computer" });
|
|
||||||
Console.WriteLine("Current turn: " + TurnManager.CurrentTurn.Name);
|
|
||||||
TurnManager.EndTurn();
|
|
||||||
Console.WriteLine("Current turn: " + TurnManager.CurrentTurn.Name);
|
|
||||||
TurnManager.EndTurn();
|
|
||||||
Console.WriteLine("Current turn: " + TurnManager.CurrentTurn.Name);
|
|
||||||
|
|
||||||
Camera = new Camera(this);
|
Camera = new Camera(this);
|
||||||
Squad = new List<Soldier>();
|
Squad = new List<Soldier>();
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
if (checkingDirection == true)
|
if (checkingDirection == true)
|
||||||
{
|
{
|
||||||
RenderHelpers.DrawLine(spriteBatch, Color.White, 2, directionStart, directionNow);
|
Utility.DrawLine(spriteBatch, Color.White, 2, directionStart, directionNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
|
|
||||||
namespace DepthsBelow
|
|
||||||
{
|
|
||||||
static class RenderHelpers
|
|
||||||
{
|
|
||||||
static Texture2D blank;
|
|
||||||
|
|
||||||
public static void DrawLine(SpriteBatch batch, Color color, float width, Vector2 start, Vector2 end)
|
|
||||||
{
|
|
||||||
if (blank == null)
|
|
||||||
{
|
|
||||||
blank = new Texture2D(Core.GraphicsDeviceManager.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
|
|
||||||
blank.SetData(new[] { color });
|
|
||||||
}
|
|
||||||
|
|
||||||
float angle = (float)Math.Atan2(end.Y - start.Y, end.X - start.X);
|
|
||||||
float length = Vector2.Distance(start, end);
|
|
||||||
|
|
||||||
batch.Draw(blank, start, null, color,
|
|
||||||
angle, Vector2.Zero, new Vector2(length, width),
|
|
||||||
SpriteEffects.None, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,6 @@ namespace DepthsBelow
|
|||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
private TurnManager turnManager;
|
private TurnManager turnManager;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Token" /> class.
|
/// Initializes a new instance of the <see cref="Token" /> class.
|
||||||
/// Preferably use <see cref="TurnManager.CreateToken" /> instead.
|
/// Preferably use <see cref="TurnManager.CreateToken" /> instead.
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using DepthsBelow.Component;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace DepthsBelow
|
namespace DepthsBelow
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -19,15 +21,15 @@ namespace DepthsBelow
|
|||||||
/// <returns>Returns a hit chance percentage.</returns>
|
/// <returns>Returns a hit chance percentage.</returns>
|
||||||
public static int CalculateHitChance(Entity attacker, Entity defender)
|
public static int CalculateHitChance(Entity attacker, Entity defender)
|
||||||
{
|
{
|
||||||
Component.Stat shooting = attacker.GetComponent<Component.Stat>();
|
Stat shooting = attacker.GetComponent<Stat>();
|
||||||
Component.Stat dodging = defender.GetComponent<Component.Stat>();
|
Stat dodging = defender.GetComponent<Stat>();
|
||||||
if (shooting == null || dodging == null)
|
if (shooting == null || dodging == null)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int baseHitChance = shooting.GetAim;
|
int baseHitChance = shooting.GetAim;
|
||||||
int baseDodgeChance = dodging.GetDodge;
|
int baseDodgeChance = dodging.GetDodge;
|
||||||
int basePenalty = shooting.Penalty((int)Vector2.Distance(attacker.GetComponent<Component.Transform>().World.Position, defender.GetComponent<Component.Transform>().World.Position) / Grid.TileSize);
|
int basePenalty = shooting.Penalty((int)Vector2.Distance(attacker.GetComponent<Transform>().World.Position, defender.GetComponent<Transform>().World.Position) / Grid.TileSize);
|
||||||
int chanceToHit = baseHitChance - baseDodgeChance - basePenalty;
|
int chanceToHit = baseHitChance - baseDodgeChance - basePenalty;
|
||||||
//Console.WriteLine(chanceToHit);
|
//Console.WriteLine(chanceToHit);
|
||||||
return chanceToHit;
|
return chanceToHit;
|
||||||
@@ -43,6 +45,23 @@ namespace DepthsBelow
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}*/
|
||||||
|
private static Texture2D blank;
|
||||||
|
|
||||||
|
public static void DrawLine(SpriteBatch batch, Color color, float width, Vector2 start, Vector2 end)
|
||||||
|
{
|
||||||
|
if (blank == null)
|
||||||
|
{
|
||||||
|
blank = new Texture2D(Core.GraphicsDeviceManager.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
|
||||||
|
blank.SetData(new[] { color });
|
||||||
|
}
|
||||||
|
|
||||||
|
float angle = (float)Math.Atan2(end.Y - start.Y, end.X - start.X);
|
||||||
|
float length = Vector2.Distance(start, end);
|
||||||
|
|
||||||
|
batch.Draw(blank, start, null, color,
|
||||||
|
angle, Vector2.Zero, new Vector2(length, width),
|
||||||
|
SpriteEffects.None, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,4 @@ ToolTip = CreateFrame("Frame")
|
|||||||
|
|
||||||
local text = CreateFrame("Text", ToolTip)
|
local text = CreateFrame("Text", ToolTip)
|
||||||
text:SetFont("Arial")
|
text:SetFont("Arial")
|
||||||
text.Value = "99%"
|
text.Value = "99%"
|
||||||
ToolTip.Text = text
|
|
||||||
Reference in New Issue
Block a user