Ejemplo n.º 1
0
    private void DrawDebugBlock(DebugBlock block)
    {
        var text = "";

        text += block.Name;
        text += "\n============";
        var datas = block.Data.Values;

        foreach (var data in datas)
        {
            text += $"\n{(data.Name == "" ? $"----- ":$"{data.Name} :")}\t{data.Value}";
        }
Ejemplo n.º 2
0
        public StateMachine(State initialState, DebugBlock debugBlock)
        {
            _initialState = initialState;
            #region DebugBlock
#if UNITY_EDITOR
            DebugBlock = debugBlock;
            DebugBlock.Define("Warning", NoTickWarningID, "StateMachine hasn't been ticked through!!!");
            DebugBlock.Define("State Type", StateTypeID);
            DebugBlock.Define("State Name", StateNameID);
            DebugBlock.Define("", DividerID);
#endif
            #endregion
            ChangeState(_initialState);
        }
Ejemplo n.º 3
0
    private void FindBlocks(MonoBehaviour target)
    {
        blocksWithNames.Clear();
        if (target != null)
        {
            Type type       = target.GetType();
            var  properties = type.GetProperties();

            foreach (var property in properties)
            {
                if (property.PropertyType == typeof(DebugBlock))
                {
                    DebugBlock block = (DebugBlock)property.GetValue(target as object);
                    if (block == null)
                    {
                        EditorGUILayout.HelpBox($"{property.Name} is null!!!", MessageType.Error);
                    }
                    blocksWithNames.Add(block);
                }
            }
        }
    }