From 0bba89a7858ce091f485e04284f853e1f7f304af Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 6 Aug 2023 17:21:45 +0100 Subject: Reformat --- .../component/movement/BaseControllerComponent.cs | 63 +++++++++++++--------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'code/pawn/component/movement/BaseControllerComponent.cs') diff --git a/code/pawn/component/movement/BaseControllerComponent.cs b/code/pawn/component/movement/BaseControllerComponent.cs index d9b24c6..a9bed5f 100644 --- a/code/pawn/component/movement/BaseControllerComponent.cs +++ b/code/pawn/component/movement/BaseControllerComponent.cs @@ -1,38 +1,40 @@ -using Sandbox; -using System; +using System; using System.Collections.Generic; +using Sandbox; namespace MurderGame; /// -/// Component designed for movement, only 1 per pawn. +/// Component designed for movement, only 1 per pawn. /// public class BaseControllerComponent : EntityComponent, ISingletonComponent { + internal HashSet Events = new(StringComparer.OrdinalIgnoreCase); + + internal HashSet Tags; + public Vector3 WishVelocity { get; set; } public virtual void Simulate( IClient cl ) { - } + public virtual void FrameSimulate( IClient cl ) { - } + public virtual void BuildInput() { - } - public Vector3 WishVelocity { get; set; } - internal HashSet Events = new( StringComparer.OrdinalIgnoreCase ); - - internal HashSet Tags; /// - /// Call OnEvent for each event + /// Call OnEvent for each event /// public virtual void RunEvents( BaseControllerComponent additionalController ) { - if ( Events == null ) return; + if ( Events == null ) + { + return; + } foreach ( var e in Events ) { @@ -42,19 +44,22 @@ public class BaseControllerComponent : EntityComponent, ISingletonCompon } /// - /// An event has been triggered - maybe handle it + /// An event has been triggered - maybe handle it /// public virtual void OnEvent( string name ) { - } /// - /// Returns true if we have this event + /// Returns true if we have this event /// public bool HasEvent( string eventName ) { - if ( Events == null ) return false; + if ( Events == null ) + { + return false; + } + return Events.Contains( eventName ); } @@ -62,26 +67,35 @@ public class BaseControllerComponent : EntityComponent, ISingletonCompon /// public bool HasTag( string tagName ) { - if ( Tags == null ) return false; + if ( Tags == null ) + { + return false; + } + return Tags.Contains( tagName ); } /// - /// Allows the controller to pass events to other systems - /// while staying abstracted. - /// For example, it could pass a "jump" event, which could then - /// be picked up by the playeranimator to trigger a jump animation, - /// and picked up by the player to play a jump sound. + /// Allows the controller to pass events to other systems + /// while staying abstracted. + /// For example, it could pass a "jump" event, which could then + /// be picked up by the playeranimator to trigger a jump animation, + /// and picked up by the player to play a jump sound. /// public void AddEvent( string eventName ) { // TODO - shall we allow passing data with the event? - if ( Events == null ) Events = new HashSet(); + if ( Events == null ) + { + Events = new HashSet(); + } if ( Events.Contains( eventName ) ) + { return; + } Events.Add( eventName ); } @@ -96,9 +110,10 @@ public class BaseControllerComponent : EntityComponent, ISingletonCompon Tags ??= new HashSet(); if ( Tags.Contains( tagName ) ) + { return; + } Tags.Add( tagName ); } } - -- cgit v1.2.3-70-g09d2