public void trigger(GameEvent e) { switch (e.type) { case GameEventType.EnableMotor: _revoluteJoint.MotorEnabled = true; break; case GameEventType.DisableMotor: _revoluteJoint.MotorEnabled = false; break; case GameEventType.ReverseMotor: _revoluteJoint.MotorSpeed = -_revoluteJoint.MotorSpeed; break; } }
public void postEvent(GameEvent e) { Dictionary<int, List<IEventHandler>> row; List<IEventHandler> handlers; if (_handlers.TryGetValue(e.type, out row)) { if (row.TryGetValue(e.originEntityId, out handlers)) { for (int i = 0; i < handlers.Count; i++) { handlers[i].trigger(e); } } } // Pass event onto level system, in case there is a goal attached to this event _levelSystem.tryCompleteEventGoal(e); }
// tryCompleteEventGoal -- Tries to handle the completion of an event goal public void tryCompleteEventGoal(GameEvent e) { Console.WriteLine("TODO: Reimplement tryCompleteEventGoal() in LevelSystem"); /* WorldMapSystem worldMapSystem = (WorldMapSystem)_systemManager.getSystem(SystemType.WorldMap); Goal goal = null; ScriptBase script = null; Dictionary<int, Goal> entityGoalMap; if (_eventGoals.TryGetValue(e.type, out entityGoalMap)) { if (entityGoalMap.TryGetValue(e.originEntityId, out goal)) { _completedGoals.Add(goal.id, goal); if (_scriptManager.scripts.TryGetValue(_uid, out script)) { script.onGoalComplete(worldMapSystem, this, goal); } } }*/ }