CryMono also supports the creation of custom nodes using idioms that C# developers will feel accustomed to, such as attribute metaprogramming. To get started with C# CryENGINE scripts, open up the sample scripts solution in Game/Scripts/CryGameCode.sln
. Add a new .cs
file to the flownodes folder, and we'll start creating the same node in C#, so you can see how the creation varies.
To start with, let's create a basic skeleton node. We need to bring the correct namespace into scope for the Flowgraph
classes, as well as set up some basic attributes for our node:
using CryEngine.Flowgraph; namespace CryGameCode.FlowNodes { [FlowNode(Name = "Multiplier", Category = "CSharpTutorial", Filter = FlowNodeFilter.Approved)] public class TutorialNode : FlowNode { } }
As in C++, nodes aren't referenced anywhere else in the project, so we assign a separate namespace for our nodes to keep them from polluting the main namespaces.