void OnPress() { if (task is ConstructRoad || task is ConstructUnit) { TaskPen.Set(task); } else { task.Start(); } // Init (task, hasText); }
public void OnPress() { if (task is ConstructRoad || task is ConstructUnit) { TaskPen.Set(task); } else { task.Start(); } if (hasText) // BAD hack - this is to get the road button working { Init(task); } }
public void TestEnabled(PerformerTask task = null) { if (task != null) { task.Start(); if ((task.Enabled && task.Performing) || (!task.Enabled && !task.Performing)) { Debug.Log("Enabled test succeeded :)"); } else { Debug.Log("Enabled test failed because enabled is " + task.Enabled + " but performing is " + task.Performing); } return; } EnabledTest enabled = new EnabledTest(); enabled.enabled = false; bool failed = false; enabled.Start(); if (enabled.Performing) { Debug.Log("Enabled test failed because the task was started but the task is disabled"); failed = true; } enabled.enabled = true; enabled.Start(); if (!enabled.Performing) { Debug.Log("Enabled test failed because the task is enabled but didn't start"); failed = true; } if (!failed) { Debug.Log("Enabled test succeeded :)"); } }
public void TestRepeat(PerformerTask repeat) { PerformableTasks.Add(repeat); repeat.onEnd += (PerformerTask task) => { Co2.WaitForFixedUpdate(() => { if (repeat.Performing) { Debug.Log("Repeat test succeeded :)"); } else { Debug.Log("Repeat test failed :("); } repeat.Stop(); }); }; if (!repeat.Settings.Repeat) { throw new System.Exception("The task '" + repeat.GetType() + "' will not repeat because its data model has Repeat set to false"); } repeat.Start(); }