39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
|
|
//
|
|
// Purpose: Part of the My Behaviour Tree Code
|
|
//
|
|
//=============================================================================
|
|
|
|
using System;
|
|
using System.Text.RegularExpressions;
|
|
using UnityEngine;
|
|
|
|
namespace MyBT {
|
|
public class Token : ScriptableObject {
|
|
[SerializeField]
|
|
public SyntaxLabel type;
|
|
[SerializeField]
|
|
public TokenLocation location;
|
|
[SerializeField]
|
|
|
|
public void Init(SyntaxLabel _type, TokenLocation _tokenLocation) {
|
|
type = _type;
|
|
location = _tokenLocation;
|
|
}
|
|
|
|
public void Destroy() {
|
|
type = SyntaxLabel.Undefined;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return $"<{type}> {location.location} '{location.code}'";
|
|
}
|
|
|
|
public Token Duplicate () {
|
|
Token t = ScriptableObject.CreateInstance<Token>();
|
|
t.type = type;
|
|
t.location = Instantiate(location);
|
|
return t;
|
|
}
|
|
}
|
|
} |