Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
craftersmine committed Mar 4, 2019
1 parent 844c12c commit 2a5aea4
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 11 deletions.
3 changes: 3 additions & 0 deletions craftersmine.EtherEngine.Content/AudioClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespace craftersmine.EtherEngine.Content
/// </summary>
public sealed class AudioClip
{
/// <summary>
/// Current audio clip Ogg stream with file
/// </summary>
public OggStream OggStream { get; private set; }

/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions craftersmine.EtherEngine.Core/AudioChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace craftersmine.EtherEngine.Core
{
/// <summary>
/// Represents scene audio channel. This class cannot be inherited
/// </summary>
public sealed class AudioChannel
{
/// <summary>
Expand Down
9 changes: 8 additions & 1 deletion craftersmine.EtherEngine.Core/CrashHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@

namespace craftersmine.EtherEngine.Core
{
public sealed class CrashHandler
/// <summary>
/// Provides static methods for exception handling
/// </summary>
public static class CrashHandler
{
/// <summary>
/// Handles provided exception, writes exception data to log file, shows message to user and then exits from game
/// </summary>
/// <param name="ex">Exception to handle</param>
public static void Handle(Exception ex)
{
Debugging.LogException(LogEntryType.Crash, ex);
Expand Down
6 changes: 6 additions & 0 deletions craftersmine.EtherEngine.Core/EnginePrefabs/DefaultScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

namespace craftersmine.EtherEngine.Core.EnginePrefabs
{
/// <summary>
/// Represents default, empty scene. This class cannot be inherited
/// </summary>
public sealed class DefaultScene : Scene
{
/// <summary>
/// Creates new <see cref="DefaultScene"/> instance
/// </summary>
public DefaultScene()
{
BackgroundColor = Color.Black;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@

namespace craftersmine.EtherEngine.Core.Exceptions
{

/// <summary>
/// The exception that is thrown when scene manager can't operate with scene
/// </summary>
[Serializable]
public class SceneManagerException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="SceneManagerException"/> class with its message string set to a system-supplied message.
/// </summary>
public SceneManagerException() { }
/// <summary>
/// Initializes a new instance of the <see cref="SceneManagerException"/> class with a specified error message.
/// </summary>
public SceneManagerException(string message) : base(message) { }
/// <summary>
/// Initializes a new instance of the <see cref="SceneManagerException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
/// </summary>
public SceneManagerException(string message, Exception inner) : base(message, inner) { }
/// <summary>
/// Initializes a new instance of the <see cref="SceneManagerException"/> class with the specified serialization and context information.
/// </summary>
protected SceneManagerException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
Expand Down
3 changes: 3 additions & 0 deletions craftersmine.EtherEngine.Core/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public static class Game
/// </summary>
public static event EventHandler<CancelEventArgs> GameExiting;

/// <summary>
/// Gets or sets current used sound device
/// </summary>
public static SoundDevice SoundDevice { get; set; }

/// <summary>
Expand Down
112 changes: 108 additions & 4 deletions craftersmine.EtherEngine.Core/Objects/ParticleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace craftersmine.EtherEngine.Objects
{
/// <summary>
/// Represents particle system. This class cannot be inherited
/// </summary>
public sealed class ParticleSystem : GameObject
{
internal List<Particle> Particles { get; set; } = new List<Particle>();
Expand All @@ -17,15 +20,53 @@ public sealed class ParticleSystem : GameObject
private Random SizeRanger = new Random();
private Random ParticleLifetimeRanger = new Random();

/// <summary>
/// Gets or sets particle lifetime
/// </summary>
public int ParticleLifetime { get; set; }
/// <summary>
/// Gets or sets particle vertical velocity vector
/// </summary>
public float ParticleVerticalVelocity { get; set; }
/// <summary>
/// Gets or sets particle horizontal velocity vector
/// </summary>
public float ParticleHorizontalVelocity { get; set; }
/// <summary>
/// Gets or sets particle size
/// </summary>
public int ParticleSize { get; set; }
/// <summary>
/// Gets or sets true if particles must have variative size, else false
/// </summary>
public bool IsParticleVariativeSize { get; set; }
/// <summary>
/// Gets used particle instance
/// </summary>
public Particle Particle { get; private set; }
/// <summary>
/// Gets current max particles limitation
/// </summary>
public int MaxParticles { get; private set; }
/// <summary>
/// Gets true if particle system is emitting particles, else false
/// </summary>
public bool IsEmitting { get; private set; }
/// <summary>
/// Gets or sets particle on update behaviour
/// </summary>
public ParticleOnUpdateDelegate OnUpdateAction { get; set; }

/// <summary>
/// Creates new <see cref="ParticleSystem"/> instance with specified parameters
/// </summary>
/// <param name="particle">Particle template</param>
/// <param name="particleLifetime">Particle lifetime</param>
/// <param name="maxParticles">Maximum particles limitaion</param>
/// <param name="particleVerticalVelocity">Particle vertical velocity vector</param>
/// <param name="particleHorizontalVelocity">Particle horizontal velocity vector</param>
/// <param name="particleSize">Particle size</param>
/// <param name="variativeSize">True if particles must have variative size, else false</param>
public ParticleSystem(Particle particle, int particleLifetime, int maxParticles, float particleVerticalVelocity, float particleHorizontalVelocity, int particleSize, bool variativeSize)
{
Particle = particle;
Expand All @@ -37,7 +78,10 @@ public ParticleSystem(Particle particle, int particleLifetime, int maxParticles,
MaxParticles = maxParticles;
Collidable = false;
}


/// <summary>
/// Calls when particle system being created
/// </summary>
public override void OnStart()
{
for (int i = 0; i < MaxParticles; i++)
Expand All @@ -54,6 +98,9 @@ public override void OnStart()
Reset();
}

/// <summary>
/// Start emit particles
/// </summary>
public void Emit()
{
if (!IsEmitting)
Expand All @@ -64,6 +111,9 @@ public void Emit()
}
}

/// <summary>
/// Stop emit particles
/// </summary>
public void StopEmit()
{
if (IsEmitting)
Expand All @@ -77,6 +127,9 @@ public void StopEmit()
}
}

/// <summary>
/// Reset particles
/// </summary>
public void Reset()
{
for (int i = 0; i < Particles.Count; i++)
Expand All @@ -91,6 +144,9 @@ public void Reset()
}
}

/// <summary>
/// Calls when particle system being updated
/// </summary>
public override void OnUpdate()
{
if (IsEmitting)
Expand Down Expand Up @@ -126,33 +182,81 @@ public override void OnUpdate()
Particles[i].Y = this.Y;
Particles[i].CurrentLifetime = ParticleLifetimeRanger.Next(-15, 0);
}
OnUpdateAction?.Invoke(Particles[i]);
}
}
}
}

/// <summary>
/// Represents particle. This class cannot be inherited
/// </summary>
public sealed class Particle : GameObject
{
/// <summary>
/// Gets or sets current particle lifetime
/// </summary>
public int CurrentLifetime { get; set; }
/// <summary>
/// Gets particle lifetime
/// </summary>
public int Lifetime { get; internal set; }
/// <summary>
/// Gets or sets particle size
/// </summary>
public int ParticleSize { get; set; }
/// <summary>
/// Gets or sets true if particle lifetime is elapsed
/// </summary>
public bool IsParticleLifetimeElapsed { get; set; }
/// <summary>
/// Gets current particle vertical velocity vector
/// </summary>
public float VerticalVelocity { get; internal set; }
/// <summary>
/// Gets current particle horizontal velocity vector
/// </summary>
public float HorizontalVelocity { get; internal set; }
/// <summary>
/// Gets particle size modifier
/// </summary>
public float SizeModifier { get; internal set; }

/// <summary>
/// Creates new <see cref="Particle"/> instance
/// </summary>
/// <param name="texture">Particle texture</param>
public Particle(Texture texture)
{
Texture = texture;
CurrentLifetime = 0;
}

/// <summary>
/// Clones particle
/// </summary>
/// <returns></returns>
public Particle Clone()
{
return new Particle(Texture) {
CurrentLifetime = CurrentLifetime, Height = Height, ParticleSize = ParticleSize,
Texture = Texture, Visible = Visible, Width = Width, X = X, Y = Y,
HorizontalVelocity = HorizontalVelocity, VerticalVelocity = VerticalVelocity, SizeModifier = SizeModifier };
CurrentLifetime = CurrentLifetime,
Height = Height,
ParticleSize = ParticleSize,
Texture = Texture,
Visible = Visible,
Width = Width,
X = X,
Y = Y,
HorizontalVelocity = HorizontalVelocity,
VerticalVelocity = VerticalVelocity,
SizeModifier = SizeModifier
};
}
}

/// <summary>
/// Represents particle OnUpdate behaviour
/// </summary>
/// <param name="particle">Updating particle</param>
public delegate void ParticleOnUpdateDelegate(Particle particle);
}
4 changes: 2 additions & 2 deletions craftersmine.EtherEngine.Input/Gamepad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
namespace craftersmine.EtherEngine.Input
{
/// <summary>
/// Allows to use gamepad input
/// Provides static methods to handle XInput gamepad input
/// </summary>
public sealed class Gamepad
public static class Gamepad
{
private static X.Gamepad fstPlayer { get; set; } = X.Gamepad_1;
private static X.Gamepad secPlayer { get; set; } = X.Gamepad_2;
Expand Down
4 changes: 2 additions & 2 deletions craftersmine.EtherEngine.Input/Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
namespace craftersmine.EtherEngine.Input
{
/// <summary>
/// Allows to get Keyboard input
/// Provides static methods to handle keyboard input
/// </summary>
public sealed class Keyboard
public static class Keyboard
{
/// <summary>
/// [ENGINE PROPERTY] Gets or sets keyboard to handle input
Expand Down
5 changes: 4 additions & 1 deletion craftersmine.EtherEngine.Input/Mouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

namespace craftersmine.EtherEngine.Input
{
public sealed class Mouse
/// <summary>
/// Provides static methods to handle mouse input
/// </summary>
public static class Mouse
{
/// <summary>
/// [ENGINE METHOD] MouseDevice.Move event handler
Expand Down

0 comments on commit 2a5aea4

Please sign in to comment.