diff --git a/Subsurface/Source/Events/ArtifactEvent.cs b/Subsurface/Source/Events/ArtifactEvent.cs index 5beb42a4c..279610058 100644 --- a/Subsurface/Source/Events/ArtifactEvent.cs +++ b/Subsurface/Source/Events/ArtifactEvent.cs @@ -62,21 +62,16 @@ namespace Barotrauma switch (state) { case 0: - state = 1; - break; - case 1: - - //item.body.LinearVelocity = Vector2.Zero; if (item.ParentInventory!=null) item.body.FarseerBody.IsKinematic = false; if (item.CurrentHull == null) return; - state = 2; + state = 1; break; - case 2: + case 1: if (!Submarine.MainSub.AtEndPosition && !Submarine.MainSub.AtStartPosition) return; Finished(); - state = 3; + state = 2; break; } } diff --git a/Subsurface/Source/Events/ScriptedEvent.cs b/Subsurface/Source/Events/ScriptedEvent.cs index 06d18c902..5d8987aa7 100644 --- a/Subsurface/Source/Events/ScriptedEvent.cs +++ b/Subsurface/Source/Events/ScriptedEvent.cs @@ -151,7 +151,6 @@ namespace Barotrauma isFinished = false; } - public virtual void Update(float deltaTime) { } @@ -159,9 +158,6 @@ namespace Barotrauma public virtual void Finished() { isFinished = true; - //EventManager.EventFinished(this); } - - } } diff --git a/Subsurface/Source/Events/Task.cs b/Subsurface/Source/Events/Task.cs index f146a0475..6709a6f4c 100644 --- a/Subsurface/Source/Events/Task.cs +++ b/Subsurface/Source/Events/Task.cs @@ -58,7 +58,6 @@ namespace Barotrauma protected virtual void Finished() { - taskManager.TaskFinished(this); isFinished = true; } } diff --git a/Subsurface/Source/Events/TaskManager.cs b/Subsurface/Source/Events/TaskManager.cs index 52b27a96d..44728cf99 100644 --- a/Subsurface/Source/Events/TaskManager.cs +++ b/Subsurface/Source/Events/TaskManager.cs @@ -10,8 +10,6 @@ namespace Barotrauma private List tasks; - //private GUIListBox taskListBox; - public List Tasks { get { return tasks; } @@ -27,11 +25,7 @@ namespace Barotrauma public TaskManager(GameSession session) { - tasks = new List(); - - //taskListBox = new GUIListBox(new Rectangle(Game1.GraphicsWidth - 250, 50, 250, 500), Color.Transparent); - //taskListBox.ScrollBarEnabled = false; - //taskListBox.Padding = GUI.style.smallPadding; + tasks = new List(); } public void AddTask(Task newTask) @@ -44,14 +38,11 @@ namespace Barotrauma public void StartShift(Level level) { CreateScriptedEvents(level); - - //taskListBox.ClearChildren(); } public void EndShift() { - //taskListBox.ClearChildren(); tasks.Clear(); } @@ -79,47 +70,17 @@ namespace Barotrauma } - public void TaskFinished(Task task) - { - - } - - - public void Update(float deltaTime) { - Task removeTask = null; foreach (Task task in tasks) { - if (task.IsFinished) - { - //foreach (GUIComponent comp in taskListBox.children) - //{ - // if (comp.UserData as Task != task) continue; - // comp.Rect = new Rectangle(comp.Rect.X, comp.Rect.Y, comp.Rect.Width, comp.Rect.Height - 1); - // comp.children[0].ClearChildren(); - // if (comp.Rect.Height < 1) - // { - // removeComponent = comp; - removeTask = task; - // } - // break; - //} - - } - else - { + if (!task.IsFinished) + { task.Update(deltaTime); } } - if (removeTask!= null) - { - //taskListBox.RemoveChild(removeComponent); - tasks.Remove(removeTask); - } - - //endShiftButton.Enabled = finished || Game1.server!=null; + tasks.RemoveAll(t => t.IsFinished); } }