using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Arbor;
[System.Serializable]publicclassEnemyInfo
{
// Declare Serialize Fields
}
[System.Serializable]publicclassFlexibleEnemyInfo : FlexibleField<EnemyInfo>
{
public FlexibleEnemyInfo(EnemyInfo value) : base(value)
{
}
public FlexibleEnemyInfo(AnyParameterReference parameter) : base(parameter)
{
}
public FlexibleEnemyInfo(InputSlotAny slot) : base(slot)
{
}
publicstaticexplicitoperator EnemyInfo(FlexibleEnemyInfo flexible)
{
return flexible.value;
}
publicstaticexplicitoperator FlexibleEnemyInfo(EnemyInfo value)
{
returnnew FlexibleEnemyInfo(value);
}
}
[System.Serializable]publicclassInputSlotEnemyInfo : InputSlot<EnemyInfo>
{
}
[System.Serializable]publicclassOutputSlotEnemyInfo : OutputSlot<EnemyInfo>
{
}
[AddComponentMenu("")]publicclassEnemyInfoVariable : Variable<EnemyInfo>
{
}
EnemyInfoListVariable.cs
1
2
3
4
5
6
7
8
9
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Arbor;
[AddComponentMenu("")]publicclassEnemyInfoListVariable : VariableList<EnemyInfo>
{
}
Commentary
EnemyInfo
A class of parameters to make by yourself.
By adding a field for serialization, you can set your own parameters with ParameterContainer.
FlexibleEnemyInfo
Class for making it possible to refer to by switching between Constant, Parameter, and Calculator.
InputSlotEnemyInfo
Class for the input slot of EnemyInfo.
OutputSlotEnemyInfo
Class for EnemyInfo output slot.
EnemyInfoVariable
Variable class to register to ParameterContainer.
The class name and the script file name must match.
EnemyInfoListVariable
VariableList class to register to ParameterContainer.
The class name and the script file name must match.
Add field
Add a field to the generated script.
As an example, let's add some fields to EnemyInfo.
Select “Variable > Created Variable Name” from the parameter type selection window.
Reference to Variable parameter
FlexibleField
You can refer to it by giving StateBehaviour etc a class of Flexible + Variable Name defined in the generated script file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Arbor;
[AddComponentMenu("")]publicclassEnemyInfoBehaviour : StateBehaviour {
public FlexibleEnemyInfo enemyInfo;
// Use this for enter state
publicoverridevoid OnStateBegin()
{
EnemyInfo value = enemyInfo.value;
Debug.Log(value.displayName);
}
}
AnyParameterReference
Use AnyParameterReference when referring directly to Parameter.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Arbor;
[AddComponentMenu("")]publicclassEnemyInfoBehaviour2 : StateBehaviour {
[ClassExtends(typeof(EnemyInfo))]public AnyParameterReference enemyInfo = new AnyParameterReference();
// Use this for enter state
publicoverridevoid OnStateBegin()
{
Parameter enemyInfoParameter = enemyInfo.parameter;
if (enemyInfoParameter != null)
{
EnemyInfo value = enemyInfoParameter.valueas EnemyInfo;
Debug.Log(value.displayName);
}
}
}