Skip to content

Commit

Permalink
Change region separation standard
Browse files Browse the repository at this point in the history
Regions are now broken up as such:

Access Level
    -> Constructors
    -> Members
    -> Member Methods
    -> Static Members
    -> Static Methods
Disposable Support
Destructors
  • Loading branch information
jamesaorson committed Jul 10, 2020
1 parent 9d42122 commit 540769a
Show file tree
Hide file tree
Showing 49 changed files with 1,564 additions and 1,658 deletions.
22 changes: 6 additions & 16 deletions Common/Behaviors/CameraBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Common.Behaviors
{
public class CameraBehavior : BehaviorComponent
{
#region Public

#region Constructors
public CameraBehavior(CameraComponent camera, int playerIndex) : base()
{
Expand All @@ -19,27 +21,15 @@ public CameraBehavior(CameraComponent camera, int playerIndex) : base()
Camera = camera;
PanVelocity = 50f;
}
#endregion Constructors
#endregion

#region Members

#region Public Members
public CameraComponent Camera { get; set; }
public int PlayerIndex { get; set; }
public float PanVelocity { get; set; }
#endregion Public Members

#region Protected Members
#endregion Protected Members

#region Private Members
#endregion Private Members

#endregion Members
#endregion

#region Member Methods

#region Public Member Methods
public override void Update(GameTime gameTime)
{
var cameraLeft = InputManager.GetAction("camera_left", PlayerIndex);
Expand Down Expand Up @@ -73,8 +63,8 @@ public override void Update(GameTime gameTime)
);
Camera.Move(cameraMove);
}
#endregion Public Member Methods
#endregion

#endregion Member Methods
#endregion
}
}
67 changes: 33 additions & 34 deletions Common/Behaviors/CubeBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Komodo.Core.ECS.Components;
using Komodo.Core.Physics;
using Komodo.Core.Physics;
using Komodo.Lib.Math;

using Color = Microsoft.Xna.Framework.Color;
Expand All @@ -11,30 +11,21 @@ namespace Common.Behaviors
{
public class CubeBehavior : BehaviorComponent
{
#region Public

#region Constructors
public CubeBehavior(string modelPath) : base()
{
ModelPath = modelPath;
}
#endregion Constructors
#endregion

#region Members

#region Public Members
public string ModelPath { get; protected set; }
public Drawable3DComponent RootComponent { get; protected set; }
#endregion Public Members

#region Protected Members
private bool _createdBoxes { get; set; }
#endregion Protected Members

#endregion Members
#endregion

#region Member Methods

#region Public Member Methods

public override void Initialize()
{
base.Initialize();
Expand All @@ -55,31 +46,39 @@ public override void Update(GameTime gameTime)
{
_createdBoxes = true;
var scale = Vector3.One * 20f;
for (int i = 0; i < 10; i++)
{
Parent.AddComponent(
new Drawable3DComponent(RootComponent.ModelData)
{
Position = new Vector3(i + 5, 0f, 0f) * scale.X,
Scale = scale
}
);
for (int i = 0; i < 10; i++)
{
Parent.AddComponent(
new Drawable3DComponent(RootComponent.ModelData)
{
Position = new Vector3(i + 5, 0f, 0f) * scale.X,
Scale = scale
}
);
}
var material = new PhysicsMaterial("box")
{
Friction = 0.8f
var material = new PhysicsMaterial("box")
{
Friction = 0.8f
};
Parent.AddComponent(
new StaticBodyComponent(new Box(2f, 2f, 2f, 1f))
{
Material = material,
}
);
Parent.AddComponent(
new StaticBodyComponent(new Box(2f, 2f, 2f, 1f))
{
Material = material,
}
);
Parent.Scale = scale;
}
}
#endregion Public Member Methods
#endregion

#endregion

#region Protected

#region Members
private bool _createdBoxes { get; set; }
#endregion

#endregion Member Methods
#endregion
}
}
33 changes: 7 additions & 26 deletions Common/Behaviors/FPSCounterBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,29 @@ namespace Common.Behaviors
{
public class FPSCounterBehavior : BehaviorComponent
{
#region Constructors
#endregion Constructors
#region Public

#region Members

#region Public Members
public TextComponent CounterText { get; protected set; }
#endregion Public Members

#region Protected Members
#endregion Protected Members

#region Private Members
#endregion Private Members

#endregion Members
#endregion

#region Member Methods

#region Public Member Methods
public override void Initialize()
{
base.Initialize();

CounterText = new TextComponent("fonts/font", Color.Black, Game.DefaultSpriteShader, "")
{
Position = Komodo.Lib.Math.Vector3.Zero
CounterText = new TextComponent("fonts/font", Color.Black, Game.DefaultSpriteShader, "")
{
Position = Komodo.Lib.Math.Vector3.Zero
};
Parent.AddComponent(CounterText);
}
public override void Update(GameTime gameTime)
{
CounterText.Text = $"{Math.Round(Game.FramesPerSecond)} FPS";
}
#endregion Public Member Methods

#region Protected Member Methods
#endregion Protected Member Methods

#region Private Member Methods
#endregion Private Member Methods
#endregion

#endregion Member Methods
#endregion
}
}
22 changes: 6 additions & 16 deletions Common/Behaviors/MoveBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace Common.Behaviors
{
public class MoveBehavior : BehaviorComponent
{
#region Public

#region Constructors
public MoveBehavior(int playerIndex) : base()
{
Expand All @@ -20,28 +22,16 @@ public MoveBehavior(int playerIndex) : base()
SprintFactor = 2f;
Velocity = 50f;
}
#endregion Constructors
#endregion

#region Members

#region Public Members
public DynamicBodyComponent Body { get; private set; }
public int PlayerIndex { get; set; }
public float SprintFactor { get; set; }
public float Velocity { get; set; }
#endregion Public Members

#region Protected Members
#endregion Protected Members

#region Private Members
#endregion Private Members

#endregion Members
#endregion

#region Member Methods

#region Public Member Methods
public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -106,8 +96,8 @@ public override void Update(GameTime gameTime)
//Body.Move(direction * Velocity);
Body.ApplyForce(direction * Velocity);
}
#endregion Public Member Methods
#endregion

#endregion Member Methods
#endregion
}
}
16 changes: 6 additions & 10 deletions Common/Behaviors/PlayerBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@ namespace Common.Behaviors
{
public class PlayerBehavior : BehaviorComponent
{
#region Public

#region Constructors
public PlayerBehavior(int playerIndex) : base()
{
PlayerIndex = playerIndex;
}
#endregion Constructors
#endregion

#region Members

#region Public Members
public int PlayerIndex { get; }
#endregion Public Members

#endregion Members
#endregion

#region Member Methods

#region Public Member Methods
public override void Initialize()
{
base.Initialize();
Expand All @@ -41,8 +37,8 @@ public override void Initialize()
public override void Update(GameTime gameTime)
{
}
#endregion Public Member Methods
#endregion

#endregion Member Methods
#endregion
}
}
36 changes: 18 additions & 18 deletions Komodo/Core/ECS/Components/BehaviorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@

namespace Komodo.Core.ECS.Components
{
/// <summary>
/// Abstract class defining all behaviors.
/// A class derived from BehaviorComponent is the main way scripting is achieved in Komodo.
/// <summary>
/// Abstract class defining all behaviors.
/// A class derived from BehaviorComponent is the main way scripting is achieved in Komodo.
/// </summary>
public abstract class BehaviorComponent : Component
{
{
#region Public

#region Constructors
protected BehaviorComponent() : base(true, null)
public BehaviorComponent() : base(true, null)
{
}
#endregion Constructors

}
#endregion

#region Member Methods

#region Public Member Methods
/// <summary>
/// Virtual method initializing a BehaviorComponent.
/// <summary>
/// Virtual method initializing a BehaviorComponent.
/// </summary>
public virtual void Initialize()
{
if (!IsInitialized)
{
IsInitialized = true;
}
}

/// <summary>
/// Abstract method for updating a BehaviorComponent.
}

/// <summary>
/// Abstract method for updating a BehaviorComponent.
/// </summary>
/// <param name="gameTime">Time passed since last <see cref="Update"/></param>
public abstract void Update(GameTime gameTime);
#endregion Public Member Methods
#endregion

#endregion Member Methods
#endregion
}
}
Loading

0 comments on commit 540769a

Please sign in to comment.