Ejemplo n.º 1
0
    public void Init()
    {
        _filePath         = "Assets/SubAssets/GameData/BehaviorTree/";
        _fileName         = string.Empty;
        _behaviorTreeData = new BehaviorTreeData();
        _runTimeInvalidSubTreeHash.Clear();

        behaviorChangeRootNode         += ChangeRootNode;
        behaviorChangeSelectId         += ChangeSelectId;
        behaviorAddNode                += AddNode;
        behaviorDeleteNode             += DeleteNode;
        behaviorLoadFile               += LoadFile;
        behaviorSaveFile               += SaveFile;
        behaviorDeleteFile             += DeleteFile;
        behaviorNodeAddChild           += NodeAddChild;
        behaviorRemoveParentNode       += RemoveParentNode;
        behaviorNodeParameter          += NodeParameterChange;
        parameterChange                += ParameterChange;
        behaviorNodeChangeParameter    += NodeChangeParameter;
        behaviorRuntimePlay            += RuntimePlay;
        behaviorAddDelConditionGroup   += NodeAddDelConditionGroup;
        behaviorOpenSubTree            += OpenSubTree;
        behaviorChangeSubTreeEntryNode += ChangeSubTreeEntryNode;
        behaviorDeleteSubTreeChild     += DeleteSubTreeChild;
        behaviorReadFile               += ReadFile;
        behaviorStandardID             += StandardID;
        behaviorSelectFile             += SelectFile;
        behaviorSaveSubTree            += SaveSubTree;
        behaviorDebugNodeParentInfo    += DebugNodeParentInfo;

        _currentSelectId      = -1;
        _currentOpenSubTreeId = -1;

        _playState = BehaviorPlayType.STOP;
    }
Ejemplo n.º 2
0
    public void OnDestroy()
    {
        behaviorChangeRootNode         -= ChangeRootNode;
        behaviorChangeSelectId         -= ChangeSelectId;
        behaviorAddNode                -= AddNode;
        behaviorDeleteNode             -= DeleteNode;
        behaviorLoadFile               -= LoadFile;
        behaviorSaveFile               -= SaveFile;
        behaviorDeleteFile             -= DeleteFile;
        behaviorNodeAddChild           -= NodeAddChild;
        behaviorRemoveParentNode       -= RemoveParentNode;
        behaviorNodeParameter          -= NodeParameterChange;
        parameterChange                -= ParameterChange;
        behaviorNodeChangeParameter    -= NodeChangeParameter;
        behaviorRuntimePlay            -= RuntimePlay;
        behaviorAddDelConditionGroup   -= NodeAddDelConditionGroup;
        behaviorOpenSubTree            -= OpenSubTree;
        behaviorChangeSubTreeEntryNode -= ChangeSubTreeEntryNode;
        behaviorDeleteSubTreeChild     -= DeleteSubTreeChild;
        behaviorReadFile               -= ReadFile;
        behaviorStandardID             -= StandardID;
        behaviorSelectFile             -= SelectFile;
        behaviorSaveSubTree            -= SaveSubTree;
        behaviorDebugNodeParentInfo    -= DebugNodeParentInfo;

        _playState = BehaviorPlayType.STOP;

        AssetDatabase.Refresh();
        UnityEngine.Caching.ClearCache();
    }