Skip to content

Commit

Permalink
Merge branch 'release/1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMcAssey committed Mar 23, 2014
2 parents caee60d + fb618a7 commit d5e6b08
Show file tree
Hide file tree
Showing 73 changed files with 2,083 additions and 571 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ SolarFusion/GameData/obj/
SolarFusion/DataPipeline/obj/
SolarFusion/DataPipeline/bin/
SolarFusion/GameData/bin/x86/Debug/GameData.dll
SolarFusion/GameData/bin/
3 changes: 1 addition & 2 deletions SolarFusion/GameData/PlayerData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PlayerData
public string playerName = "";

//Animation
public string playerAsset = "";
public string playerRef = "";
public string defaultAnimation = "";
public float playerScale = 1f;
public int maxFrameCount = 1;
Expand All @@ -22,7 +22,6 @@ public class PlayerData
//Settings
public float moveSpeed = 1f;
public float jumpSpeed = 1f;
public float jumpHeight = 10f;

public bool hiddenCharacter = false;
}
Expand Down
Binary file not shown.
48 changes: 25 additions & 23 deletions SolarFusion/SolarFusion/SolarFusion/Core/.NET/HashSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,61 @@
namespace Containers
{
/// <summary>
/// HashSet for Xbox360.
/// HashSet for Xbox 360 functionality.
/// </summary>
/// <typeparam name="T"></typeparam>
public class HashSet<T> : ICollection<T>
{
private Dictionary<T, short> MyDict;
private Dictionary<T, short> mDict;

public HashSet()
{
MyDict = new Dictionary<T, short>();
this.mDict = new Dictionary<T, short>();
}

public HashSet(IEnumerable enumer)
public HashSet(HashSet<T> from)
{
MyDict = new Dictionary<T, short>();
foreach (T item in enumer)
{
MyDict.Add(item, 0);
}
this.mDict = new Dictionary<T, short>();
foreach (T n in from)
this.mDict.Add(n, 0);
}
// Methods

#region "Methods"
public void Add(T item)
{
// We don't care for the value in dictionary, Keys matter.
MyDict.Add(item, 0);
if(!this.Contains(item))
this.mDict.Add(item, 0);
}

public void Clear()
{
MyDict.Clear();
this.mDict.Clear();
}

public bool Contains(T item)
{
return MyDict.ContainsKey(item);
return this.mDict.ContainsKey(item);
}

public void CopyTo(T[] array, int arrayIndex)
{
throw new NotImplementedException();
foreach (var _item in this.mDict.Keys)
array[arrayIndex++] = _item;
}

public bool Remove(T item)
{
return MyDict.Remove(item);
return this.mDict.Remove(item);
}

public IEnumerator<T> GetEnumerator()
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
return this.mDict.Keys.GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
throw new NotImplementedException();
return this.mDict.Keys.GetEnumerator();
}

public void UnionWith(IEnumerable<T> other)
Expand All @@ -68,21 +68,23 @@ public void UnionWith(IEnumerable<T> other)
{
try
{
MyDict.Add(item, 0);
this.mDict.Add(item, 0);
}
catch (ArgumentException) { }
}
}
#endregion

// Properties
#region "Properties"
public int Count
{
get { return MyDict.Keys.Count; }
get { return this.mDict.Keys.Count; }
}

public bool IsReadOnly
{
get { return false; }
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void X360_ReadFile()
X360_CreateNewFile(); // Creates a new file.
}
}
catch (InvalidOperationException ex01) // Error reading and deserializing the file, so creates a new one.
catch (InvalidOperationException ex) // Error reading and deserializing the file, so creates a new one.
{
if (_stream != null)
_stream.Close(); // Closes the stream if it exists.
Expand Down
6 changes: 5 additions & 1 deletion SolarFusion/SolarFusion/SolarFusion/Core/Entities/AI/AI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public Vector2 Position
set { animation.Position = value; }
}

public AI(uint id) : base(id) { }
public AI(uint id)
: base(id)
{
this.Score = 1;
}

public override void Update(GameTime gameTime)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ public class Enemy_MercBot : AI
public Enemy_MercBot(uint id, ContentManager virtualContent, Vector2 position)
: base(id)
{
Texture2D tmpTexture = virtualContent.Load<Texture2D>("Sprites/Enemies/MercBot");
Texture2D tmpTexture = virtualContent.Load<Texture2D>("Sprites/Enemies/mercbot/spritesheet");
this.animation = new AnimatedSprite(tmpTexture, 3, 3);

this.animation.AddAnimation("idle", 1, 3, 3);
this.animation.AddAnimation("left", 2, 3, 3);
this.animation.AddAnimation("right", 3, 3, 3);

this.animation.Position = position;
this.animation.Origin = new Vector2((tmpTexture.Width / 3f) / 2f, (tmpTexture.Height / 3f) / 2f);
this.animation.Position = new Vector2(position.X, position.Y - 15);
this.animation.Scale = 1.5f;
this.animation.CurrentAnimation = "idle";
this.animation.Loop = true;

this.Health = 100;
this.Speed = 1f;
}
Expand Down
73 changes: 38 additions & 35 deletions SolarFusion/SolarFusion/SolarFusion/Core/Entities/EntityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,26 @@ public class EntityManager
public List<uint> dynamicObjects;
public List<uint> projectileObjects;
public Camera2D camera;
protected Vector2 mGravity;

//Collision Detection
Dictionary<uint, BoundingBoxes> boundingBoxes;
List<Bound> horizontalAxis;
HashSet<CollisionPair> horizontalOverlaps;
HashSet<CollisionPair> collisions;

#region "Properties"
public Vector2 Gravity
{
get { return this.mGravity; }
}
#endregion

public EntityManager(ContentManager _content)
{
this.virtualContent = _content; //Gets the ContentManager passed.
gameObjects = new Dictionary<uint, GameObjects>();
this.mGravity = new Vector2(0f, -198.0f);

createdGameObjects = new Queue<GameObjects>();
destroyedGameObjects = new Queue<GameObjects>();
Expand Down Expand Up @@ -70,18 +79,16 @@ public void Update(GameTime gameTime)
while (createdGameObjects.Count > 0)
{
GameObjects go = createdGameObjects.Dequeue();
if (go is AI || go is PowerUp || go is LevelObject)
{
if (go is AI || go is PowerUp || go is LevelObject || go is Blast || go is Player)
dynamicObjects.Add(go.ID);
}

AddGameObject(go);
}

while (destroyedGameObjects.Count > 0)
{
GameObjects go = destroyedGameObjects.Dequeue();
if (go is AI || go is PowerUp || go is LevelObject)
if (go is AI || go is PowerUp || go is LevelObject || go is Blast || go is Player)
{
dynamicObjects.Remove(go.ID);
}
Expand Down Expand Up @@ -114,31 +121,12 @@ public GameObjects DestroyObject(uint id)

public uint[] QueryRegion(Rectangle bounds)
{
HashSet<uint> horizontalMatches = new HashSet<uint>(); //Create a new HashSet to compare matches
HashSet<uint> verticalMatches = new HashSet<uint>();

Bound left = new Bound(null, bounds.Left, BoundType.Min); //Creates a new bound for left.
int minHorizontalIndex = horizontalAxis.BinarySearch(left); //Searches the axis for the bound and sets it as the minimum amount..

if (minHorizontalIndex < 0) //If its less than zero
{
minHorizontalIndex = ~minHorizontalIndex; //NOT the number
}

Bound right = new Bound(null, bounds.Right, BoundType.Max);
int maxHorizontalIndex = horizontalAxis.BinarySearch(right);

if (maxHorizontalIndex < 0)
{
maxHorizontalIndex = ~maxHorizontalIndex;
}

for (int i = minHorizontalIndex; i < maxHorizontalIndex; i++)
{
horizontalMatches.Add(horizontalAxis[i].Box.GameObjectID); //NEED TO DO
}
HashSet<uint> queryMatches = new HashSet<uint>(); //Create a new HashSet to compare matches
foreach (uint goID in this.dynamicObjects)
if (bounds.Intersects(this.GetObject(goID).Bounds))
queryMatches.Add(goID);

return horizontalMatches.ToArray();
return queryMatches.ToArray();
}

public uint NextID()
Expand All @@ -163,15 +151,12 @@ public PowerUp CreatePowerup(PowerUpType powerupType, Vector2 position)
case PowerUpType.EnergyBall:
powerup = new PowerUp_EnergyBall(id, virtualContent, position);
break;
case PowerUpType.Crate:
powerup = new PowerUp_Crate(id, virtualContent, position);
break;
case PowerUpType.Dynamite:
powerup = new PowerUp_Dynamite(id, virtualContent, position);
break;
case PowerUpType.Crystal:
powerup = new PowerUp_Crystal(id, virtualContent, position);
break;
case PowerUpType.Warp:
powerup = new PowerUp_Warp(id, virtualContent, position);
break;
default:
powerup = new PowerUp_EnergyBall(id, virtualContent, position);
break;
Expand Down Expand Up @@ -202,6 +187,18 @@ public AI CreateEnemy(EnemyType enemyType, Vector2 position)
return enemy;
}

public Blast CreateBullet(Blast _bullet)
{
QueueGameObjectForCreation(_bullet);
return _bullet;
}

public Player CreatePlayer(Player _player)
{
QueueGameObjectForCreation(_player);
return _player;
}

public LevelObject CreateLevelObject(LevelObjectType levelObjectType, Vector2 position)
{
LevelObject levelobject;
Expand All @@ -212,8 +209,14 @@ public LevelObject CreateLevelObject(LevelObjectType levelObjectType, Vector2 po
case LevelObjectType.Solid:
levelobject = new LevelObject_Solid(id, virtualContent, position);
break;
case LevelObjectType.NonSolid:
levelobject = new LevelObject_NonSolid(id, virtualContent, position);
break;
case LevelObjectType.Crate:
levelobject = new LevelObject_Crate(id, virtualContent, position);
break;
default:
levelobject = new LevelObject_Solid(id, virtualContent, position);
levelobject = new LevelObject_Crate(id, virtualContent, position);
break;
}

Expand Down
11 changes: 6 additions & 5 deletions SolarFusion/SolarFusion/SolarFusion/Core/Entities/GameObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ namespace SolarFusion.Core
public enum ObjectType
{
Player = 0,
Enemy = 1,
PowerUp = 2,
LevelObject = 3,
Other = 4,
Enemy,
PowerUp,
LevelObject,
Bullet,
Other,
}

public enum MoveDirection
Expand All @@ -29,7 +30,7 @@ public abstract class GameObjects
public readonly uint ID;
public ObjectType ObjectType = ObjectType.Other;
public float LayerDepth;
public int Score = 1;
public int Score = 0;
public abstract Rectangle Bounds { get; }
public bool Hidden = false;
public Rectangle defaultBounds;
Expand Down
Loading

0 comments on commit d5e6b08

Please sign in to comment.