Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: code style #263

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 208 additions & 0 deletions Demo/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@

[*]
charset = utf-8-bom
end_of_line = crlf
trim_trailing_whitespace = false
insert_final_newline = false
indent_style = space
indent_size = 4

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
csharp_space_after_cast = true
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_naming_rule.event_rule.import_to_resharper = True
dotnet_naming_rule.event_rule.resharper_description = Events
dotnet_naming_rule.event_rule.resharper_guid = 0c4c6401-2a1f-4db1-a21f-562f51542cf8
dotnet_naming_rule.event_rule.severity = warning
dotnet_naming_rule.event_rule.style = on_upper_camel_case_style
dotnet_naming_rule.event_rule.symbols = event_symbols
dotnet_naming_rule.private_constants_rule.import_to_resharper = True
dotnet_naming_rule.private_constants_rule.resharper_description = Constant fields (private)
dotnet_naming_rule.private_constants_rule.resharper_guid = 236f7aa5-7b06-43ca-bf2a-9b31bfcff09a
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
dotnet_naming_rule.private_instance_fields_rule.import_to_resharper = True
dotnet_naming_rule.private_instance_fields_rule.resharper_description = Instance fields (private)
dotnet_naming_rule.private_instance_fields_rule.resharper_guid = 4a98fdf6-7d98-4f5a-afeb-ea44ad98c70c
dotnet_naming_rule.private_instance_fields_rule.severity = warning
dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style_1
dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
dotnet_naming_rule.private_instance_fields_rule_1.import_to_resharper = True
dotnet_naming_rule.private_instance_fields_rule_1.resharper_description = Instance fields (private)
dotnet_naming_rule.private_instance_fields_rule_1.resharper_guid = 4a98fdf6-7d98-4f5a-afeb-ea44ad98c70c
dotnet_naming_rule.private_instance_fields_rule_1.severity = warning
dotnet_naming_rule.private_instance_fields_rule_1.style = lower_camel_case_style_1
dotnet_naming_rule.private_instance_fields_rule_1.symbols = private_instance_fields_symbols_1
dotnet_naming_rule.private_instance_fields_rule_2.import_to_resharper = True
dotnet_naming_rule.private_instance_fields_rule_2.resharper_description = Instance fields (private)
dotnet_naming_rule.private_instance_fields_rule_2.resharper_guid = 4a98fdf6-7d98-4f5a-afeb-ea44ad98c70c
dotnet_naming_rule.private_instance_fields_rule_2.severity = warning
dotnet_naming_rule.private_instance_fields_rule_2.style = lower_camel_case_style_1
dotnet_naming_rule.private_instance_fields_rule_2.symbols = private_instance_fields_symbols_2
dotnet_naming_rule.private_static_fields_rule.import_to_resharper = True
dotnet_naming_rule.private_static_fields_rule.resharper_description = Static fields (private)
dotnet_naming_rule.private_static_fields_rule.resharper_guid = f9fce829-e6f4-4cb2-80f1-5497c44f51df
dotnet_naming_rule.private_static_fields_rule.severity = warning
dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = True
dotnet_naming_rule.private_static_readonly_rule.resharper_description = Static readonly fields (private)
dotnet_naming_rule.private_static_readonly_rule.resharper_guid = 15b5b1f1-457c-4ca6-b278-5615aedc07d3
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
dotnet_naming_rule.unity_serialized_field_rule.severity = warning
dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style_1
dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
dotnet_naming_rule.unity_serialized_field_rule_1.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_rule_1.resharper_description = Unity serialized field
dotnet_naming_rule.unity_serialized_field_rule_1.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
dotnet_naming_rule.unity_serialized_field_rule_1.severity = warning
dotnet_naming_rule.unity_serialized_field_rule_1.style = lower_camel_case_style_1
dotnet_naming_rule.unity_serialized_field_rule_1.symbols = unity_serialized_field_symbols_1
dotnet_naming_rule.unity_serialized_field_rule_2.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_rule_2.resharper_description = Unity serialized field
dotnet_naming_rule.unity_serialized_field_rule_2.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
dotnet_naming_rule.unity_serialized_field_rule_2.severity = warning
dotnet_naming_rule.unity_serialized_field_rule_2.style = lower_camel_case_style_1
dotnet_naming_rule.unity_serialized_field_rule_2.symbols = unity_serialized_field_symbols_2
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.lower_camel_case_style.required_prefix = _
dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
dotnet_naming_style.on_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.on_upper_camel_case_style.required_prefix = On
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
dotnet_naming_symbols.event_symbols.applicable_accessibilities = *
dotnet_naming_symbols.event_symbols.applicable_kinds = event
dotnet_naming_symbols.event_symbols.resharper_applicable_kinds = event
dotnet_naming_symbols.event_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
dotnet_naming_symbols.private_constants_symbols.resharper_applicable_kinds = constant_field
dotnet_naming_symbols.private_constants_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_instance_fields_symbols.resharper_applicable_kinds = field,readonly_field
dotnet_naming_symbols.private_instance_fields_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.private_instance_fields_symbols_1.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols_1.applicable_kinds = field
dotnet_naming_symbols.private_instance_fields_symbols_1.resharper_applicable_kinds = field,readonly_field
dotnet_naming_symbols.private_instance_fields_symbols_1.resharper_required_modifiers = instance
dotnet_naming_symbols.private_instance_fields_symbols_2.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols_2.applicable_kinds = field
dotnet_naming_symbols.private_instance_fields_symbols_2.resharper_applicable_kinds = field,readonly_field
dotnet_naming_symbols.private_instance_fields_symbols_2.resharper_required_modifiers = instance
dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.private_static_fields_symbols.resharper_applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = readonly,static
dotnet_naming_symbols.private_static_readonly_symbols.resharper_applicable_kinds = readonly_field
dotnet_naming_symbols.private_static_readonly_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_accessibilities = *
dotnet_naming_symbols.unity_serialized_field_symbols_1.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols_1.resharper_required_modifiers = instance
dotnet_naming_symbols.unity_serialized_field_symbols_2.applicable_accessibilities = *
dotnet_naming_symbols.unity_serialized_field_symbols_2.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols_2.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols_2.resharper_required_modifiers = instance
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = true:suggestion
dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

# ReSharper properties
resharper_autodetect_indent_settings = true
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_ifelse = required_for_multiline
resharper_braces_for_while = required
resharper_cpp_insert_final_newline = true
resharper_csharp_empty_block_style = together_same_line
resharper_csharp_insert_final_newline = true
resharper_csharp_int_align_comments = true
resharper_csharp_max_line_length = 300
resharper_csharp_wrap_after_declaration_lpar = true
resharper_csharp_wrap_before_declaration_rpar = true
resharper_csharp_wrap_lines = false
resharper_formatter_off_tag = @formatter:off
resharper_formatter_on_tag = @formatter:on
resharper_formatter_tags_enabled = true
resharper_indent_preprocessor_directives = normal
resharper_place_accessorholder_attribute_on_same_line = false
resharper_place_accessor_attribute_on_same_line = false
resharper_place_field_attribute_on_same_line = false
resharper_place_record_field_attribute_on_same_line = true
resharper_place_simple_anonymousmethod_on_single_line = false
resharper_place_simple_embedded_statement_on_same_line = false
resharper_trailing_comma_in_multiline_lists = true
resharper_use_indent_from_vs = false

# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = hint
resharper_arrange_type_modifiers_highlighting = hint
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
resharper_mvc_action_not_resolved_highlighting = warning
resharper_mvc_area_not_resolved_highlighting = warning
resharper_mvc_controller_not_resolved_highlighting = warning
resharper_mvc_masterpage_not_resolved_highlighting = warning
resharper_mvc_partial_view_not_resolved_highlighting = warning
resharper_mvc_template_not_resolved_highlighting = warning
resharper_mvc_view_component_not_resolved_highlighting = warning
resharper_mvc_view_component_view_not_resolved_highlighting = warning
resharper_mvc_view_not_resolved_highlighting = warning
resharper_razor_assembly_not_resolved_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
resharper_web_config_module_not_resolved_highlighting = warning
resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning

[{*.har,*.jsb2,*.jsb3,*.json,*.jsonc,*.postman_collection,*.postman_collection.json,*.postman_environment,*.postman_environment.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,.ws-context,jest.config}]
indent_style = space
indent_size = 2

[{*.yaml,*.yml}]
indent_style = space
indent_size = 2

[*.asmdef]
indent_style = space
indent_size = 2

[*.asmref]
indent_style = space
indent_size = 2

[*.{appxmanifest,asax,ascx,aspx,axaml,blockshader,build,c,c++,c++m,cc,ccm,cginc,compute,cp,cpp,cppm,cs,cshtml,cu,cuh,cxx,cxxm,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,h++,hh,hlsl,hlsli,hlslinc,hp,hpp,hxx,icc,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,mxx,nuspec,paml,razor,resw,resx,shader,shaderFoundry,skin,tcc,tpp,urtshader,usf,ush,uxml,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4
7 changes: 6 additions & 1 deletion Package/Runtime/CrashKonijn.Agent.Core/Delegates.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
namespace CrashKonijn.Agent.Core
{
public delegate void ActionDelegate(IAction action);

public delegate void AgentActionDelegate(IAgent agent, IAction action);

public delegate void TargetDelegate(ITarget target);

public delegate void TargetRangeDelegate(ITarget target, bool inRange);

public delegate void AgentDelegate(IAgent agent);

public delegate void EmptyDelegate();
}
}
4 changes: 2 additions & 2 deletions Package/Runtime/CrashKonijn.Agent.Core/Enums/DebugMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ public enum DebugMode
{
None,
Log,
Console
Console,
}
}
}
4 changes: 2 additions & 2 deletions Package/Runtime/CrashKonijn.Agent.Core/Enums/DebugSeverity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ public enum DebugSeverity
{
Log,
Warning,
Error
Error,
}
}
}
30 changes: 16 additions & 14 deletions Package/Runtime/CrashKonijn.Agent.Core/Interfaces/IAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,43 @@ public interface IAction
float GetStoppingDistance();
bool IsInRange(IMonoAgent agent, float distance, IActionData data, IComponentReference references);
IActionData GetData();

/// <summary>
/// Called when the action is created
/// Called when the action is created
/// </summary>
void Created();

/// <summary>
/// Check if the action is valid
/// Check if the action is valid
/// </summary>
bool IsValid(IActionReceiver agent, IActionData data);

/// <summary>
/// Called when the action is started/assigned to an agent
/// Called when the action is started/assigned to an agent
/// </summary>
void Start(IMonoAgent agent, IActionData data);

/// <summary>
/// Called the first time the action is performed
/// Called the first time the action is performed
/// </summary>
void BeforePerform(IMonoAgent agent, IActionData data);

/// <summary>
/// Called every frame while the action is being performed
/// Called every frame while the action is being performed
/// </summary>
IActionRunState Perform(IMonoAgent agent, IActionData data, IActionContext context);

/// <summary>
/// Called when the action is stopped (forced or otherwise)
/// Called when the action is stopped (forced or otherwise)
/// </summary>
void Stop(IMonoAgent agent, IActionData data);

/// <summary>
/// Called when the action is completed
/// Called when the action is completed
/// </summary>
void Complete(IMonoAgent agent, IActionData data);

bool IsExecutable(IActionReceiver agent, bool conditionsMet);
bool IsEnabled(IActionReceiver agent);
}
}
}
12 changes: 8 additions & 4 deletions Package/Runtime/CrashKonijn.Agent.Core/Interfaces/IAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,31 @@ public interface IAgent : IActionReceiver
List<Type> DisabledActions { get; }
AgentState State { get; }
AgentMoveState MoveState { get; }

[Obsolete("Use ActionState.Action instead.")]
IAction CurrentAction { get; }

[Obsolete("Use ActionState.Data instead.")]
IActionData CurrentActionData { get; }

[Obsolete("Use ActionState.RunState instead.")]
IActionRunState RunState { get; }

IAgentDistanceObserver DistanceObserver { get; }
ITarget CurrentTarget { get; }

void Initialize();
void Run();

void CompleteAction(bool resolveAction = true);
void ResolveAction();
void EnableAction<TAction>() where TAction : IAction;
void DisableAction<TAction>() where TAction : IAction;

[Obsolete("Use GoapActionProvider.CurrentPlan.Goal instead")]
object CurrentGoal { get; set; }

[Obsolete("Use GoapActionProvider.AgentType instead")]
object GoapSet { get; set; }
}
}
}
20 changes: 11 additions & 9 deletions Package/Runtime/CrashKonijn.Agent.Core/Interfaces/IAgentEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,39 @@ public interface IAgentEvents
// Actions
event ActionDelegate OnActionStart;
void ActionStart(IAction action);

event ActionDelegate OnActionEnd;
void ActionEnd(IAction action);

event ActionDelegate OnActionStop;
void ActionStop(IAction action);

event ActionDelegate OnActionComplete;
void ActionComplete(IAction action);

// Targets
event TargetDelegate OnTargetInRange;
void TargetInRange(ITarget target);

event TargetDelegate OnTargetNotInRange;
void TargetNotInRange(ITarget target);

event TargetRangeDelegate OnTargetChanged;
void TargetChanged(ITarget target, bool inRange);

event EmptyDelegate OnTargetLost;
void TargetLost();

event TargetDelegate OnMove;
void Move(ITarget target);

[Obsolete("Use GoapActionProvider.Events.OnNoActionFound instead")]
event ActionDelegate OnNoActionFound;

[Obsolete("Use GoapActionProvider.Events.OnNoActionFound instead")]
event ActionDelegate OnGoalCompleted;

[Obsolete("Use TargetNotInRange instead")]
event TargetDelegate OnTargetOutOfRange;
}
}
}
Loading
Loading