public TileGeneration GetTile() { if (_debugField == null) { _debugField = FindObjectOfType <DebugField>(); } _debugField.ShowDebugText("in Get tile"); var tilesThatAtPool = _tilePool.Where(t => t.IsInThePool == true).ToArray(); TileGeneration tile; try { tile = tilesThatAtPool[Random.Range(0, tilesThatAtPool.Length)]; } catch (IndexOutOfRangeException) { Debug.Log(""); return(null); } tile.IsInThePool = false; return(tile); }
public static void Draw <TLeaf>(this HierarchicalTree <TLeaf> tree, bool drawSettings = true) where TLeaf : IHierarchicalTreeLeaf { if (!drawSettings || ImGui.CollapsingHeader($"Hierarchical Tree")) { var branchName = (DebugField <string>) "branchName"; var branches = (DebugField <Dictionary <string, HierarchicalTree <TLeaf> > >) "branches"; var leaves = (DebugField <HashSet <TreeLeaf <IHierarchicalTreeLeaf> > >) "leaves"; DebugField.SetOwner(tree, branchName, branches, leaves); if (drawSettings) { var settings = (DebugField <HierarchicalTreeSettingsData>)(tree, "settings"); if (!settings.AssertDrawable(branchName, branches, leaves)) { return; } var folderRegex = (DebugField <Regex>) "folderRegex" + settings.Value; if (drawSettings && folderRegex.AssertDrawable()) { ImGui.Text($"Settings: {folderRegex.Value.ToString()}"); ImGui.Separator(); } } using (var branchNode = ImGuiUn.ScopeTreeNode(branchName.Value)) { if (!branchNode.IsOpen) { return; } if (branches.Value != null) { foreach (var branch in branches.Value.Values) { branch.Draw(false); } } if (leaves.Value != null) { using (var leafNode = branches.Value != null ? ImGuiUn.ScopeTreeNode(leaves.Name) : null) { if (leafNode != null && !leafNode.IsOpen) { return; } foreach (var leaf in leaves.Value) { ImGui.Text($"- {leaf.Name}{leaf.Extension}{(leaf.LeafData.Size < 0 ? string.Empty : $" ({leaf.LeafData.Size.ToReadableSize()})")}"); } } } } } }
public ModifiersDebugField(ModifierCollection mods, string idStr) { this.mods = mods; this.idStr = idStr; this.oldState = mods.ToBitfield(); this.field = new DebugField(); }
public static bool DrawHeader(this DebugField field, string text) { if (!field.AssertDrawable()) { return(false); } return(ImGui.CollapsingHeader(text)); }
internal void SetOwner(DebugMenu.IDebugMenuOwner owner) { if (this.owner == null) { this.owner = owner; DebugField.SetOwnerToAllDebugFields(this, owner); ManualInit(); } }
public static bool AssertDrawable(this DebugField field) { if (field.IsValid) { return(true); } ImGui.TextColored(Color.red, $"Debug field '{field.Name}' is invalid !"); return(false); }
private void Awake() { _debugField = FindObjectOfType <DebugField>(); _debugField.ShowDebugText("awake in level Constructor"); //Time.timeScale = 1; //GenerateLevel(_startTile); //_currentTiles = new List<ITile>(); //_currentTiles.Add(_startTile); //_pool = FindObjectOfType<MapElementPool>(); //_fogConstructor = GetComponent<FogConstructor>(); //_enemiesConstructor = GetComponent<EnemiesConstructor>(); }
/// <summary> /// Check debugging status for ScriptableObject if you have one in stored in class /// Use singleton to call this /// </summary> /// <param name="field">DebugField scriptable object contains bool debug ON/OFF</param> /// <returns></returns> public bool IsDebugging(DebugField field) { for (int i = 0; i < debugFields.Length; i++) { Debug.Log(debugFields[i].name); if (field == debugFields[i]) { return(debugFields[i].enableDebug); } } return(false); }
public static bool AssertDrawable(this DebugField field, params DebugField[] fields) { bool allValid = true; for (int f = 0; f < fields.Length + Const.ONE_ITEM; f++) { var target = f == 0 ? field : fields[f - 1]; if (!target.IsValid) { allValid = false; ImGui.TextColored(Color.red, $"Debug field '{target.Name}' is invalid !"); } } return(allValid); }
protected override void ManualInit() { states = "states"; }
public DelegateStateMachineSection(string stateMachineFieldName = STATEMACHINE_FIELD) : base($"State machine <{typeof(TTrigger).Name}>") { stateMachine = stateMachineFieldName; }
protected override void ManualInit() { base.ManualInit(); connections = "connections"; }