Skip to content

Commit

Permalink
updating variable factory and adding start and exit functions
Browse files Browse the repository at this point in the history
  • Loading branch information
EarliestFall988 committed Dec 9, 2023
1 parent 667a953 commit c2ea759
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
24 changes: 24 additions & 0 deletions State Machine/Function Definitions/ExitFunction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using ValkyrieFSMCore;

namespace Valkyrie_Server.State_Machine.Function_Definitions
{
public class ExitFunction : FunctionDefinition
{

public ExitFunction()
{
DefineFunction();
}

protected override void DefineFunction()
{

///close or resolve anything that might be neccesary for the process to complete here...

Function = () =>
{
return 1; //exit the process
};
}
}
}
23 changes: 23 additions & 0 deletions State Machine/Function Definitions/StartFunction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using ValkyrieFSMCore;

namespace Valkyrie_Server.State_Machine.Function_Definitions
{
public sealed class StartFunction : FunctionDefinition
{
public StartFunction()
{
DefineFunction();
}

protected override void DefineFunction()
{

//do any setting up needed here if desired

Function = () =>
{
return 1; //boot the process and start normally.
};
}
}
}
37 changes: 36 additions & 1 deletion State Machine/VariableTypes/VariableFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,47 @@ public class VariableFactory
/// </summary>
void Register()
{
VariableConstructors.Add("projects", ("this variable maps to a list of projects", (key, io) =>
VariableConstructors.Add("projects", ("this type maps to a list of projects", (key, io) =>
{
var x = VariableDefinition<List<Project>>.CreateCustom(key, "projects", new List<Project>(), io);
return x;
}
));

VariableConstructors.Add("project", ("this is a project type", (key, io) =>
{
var x = VariableDefinition<Project>.CreateCustom(key, "project", new Project(), io);
return x;
}
));

VariableConstructors.Add("string", ("this is a text type that can store words, special characters. and numbers (not the value of the number).", (key, io) =>
{
var x = VariableDefinition<string>.CreateCustom(key, "string", "", io);
return x;
}
));

VariableConstructors.Add("decimal", ("the type represents decimal values (ex. 1.0, 2.34, -32.355 ...)", (key, io) =>
{
var x = VariableDefinition<float>.CreateCustom(key, "decimal", 0, io); // 👈 I know this is not an actual decimal type value. human readability is what I am after...
return x;
}
));

VariableConstructors.Add("integer", ("this type represents whole number values (ex. 1, 5 ,-3 ...)", (key, io) =>
{
var x = VariableDefinition<int>.CreateCustom(key, "integer", 0, io);
return x;
}
));

VariableConstructors.Add("boolean", ("this type is either true or false", (key, io) =>
{
var x = VariableDefinition<bool>.CreateCustom(key, "boolean", false, io);
return x;
}
));
}

/// <summary>
Expand Down

0 comments on commit c2ea759

Please sign in to comment.