public EditorRevoluteActor(EditorLevel level, XElement data) : base(level, data) { _position = Loader.loadVector2(data.Attribute("position"), Vector2.Zero); _actorA = data.Attribute("actor_a").Value == "-1" ? null : level.getActor(int.Parse(data.Attribute("actor_a").Value)); _actorB = data.Attribute("actor_b").Value == "-1" ? null : level.getActor(int.Parse(data.Attribute("actor_b").Value)); _lowerAngle = Loader.loadFloat(data.Attribute("lower_angle"), 0f); _upperAngle = Loader.loadFloat(data.Attribute("upper_angle"), 0f); _enableLimit = Loader.loadBool(data.Attribute("enable_limit"), false); _maxMotorTorque = Loader.loadFloat(data.Attribute("max_motor_torque"), 0f); _motorSpeed = Loader.loadFloat(data.Attribute("motor_speed"), 0f); _enableMotor = Loader.loadBool(data.Attribute("enable_motor"), false); initializeControls(); }
public EditorCollisionFilterActor(EditorLevel level, XElement data) : base(level, data) { _selectedPoints = new List <PointListNode>(); if (data.Attribute("actor_a").Value != "-1") { _actorA = level.getActor(int.Parse(data.Attribute("actor_a").Value)); } if (data.Attribute("actor_b").Value != "-1") { _actorB = level.getActor(int.Parse(data.Attribute("actor_b").Value)); } initializeControls(Vector2.Zero, Vector2.Zero); }
public EditorCircuitActor(EditorLevel level, XElement data) : base(level, data) { _circuit = level.controller.editorController.circuitController.getCircuit(data.Attribute("circuit_uid").Value); _position = Loader.loadVector2(data.Attribute("position"), Vector2.Zero); _connections = new List <CircuitConnection>(); foreach (XElement connectionData in data.Elements("CircuitConnection")) { EditorActor actor = level.getActor(int.Parse(connectionData.Attribute("actor_id").Value)); Gate gate = _circuit.getGate(int.Parse(connectionData.Attribute("gate_id").Value)); string connectionType = connectionData.Attribute("type").Value; if (connectionType == "input") { GameEventType listenToEvent = (GameEventType)Loader.loadEnum(typeof(GameEventType), connectionData.Attribute("listen_to_event"), 0); _connections.Add(new CircuitInputConnection(this, actor, gate, listenToEvent)); } else if (connectionType == "output") { GameEventType onEnabledEvent = (GameEventType)Loader.loadEnum(typeof(GameEventType), connectionData.Attribute("on_enabled_event"), 0); GameEventType onDisabledEvent = (GameEventType)Loader.loadEnum(typeof(GameEventType), connectionData.Attribute("on_disabled_event"), 0); _connections.Add(new CircuitOutputConnection(this, actor, gate, onEnabledEvent, onDisabledEvent)); } } initializeGateControls(); }
public EditorPrismaticActor(EditorLevel level, XElement data) : base(level, data) { int actorIdA = Loader.loadInt(data.Attribute("actor_a"), -1); int actorIdB = Loader.loadInt(data.Attribute("actor_b"), -1); _position = Loader.loadVector2(data.Attribute("position"), Vector2.Zero); _actorA = actorIdA == -1 ? null : level.getActor(actorIdA); _actorB = actorIdB == -1 ? null : level.getActor(actorIdB); Vector2 axis = Loader.loadVector2(data.Attribute("axis"), new Vector2(1, 0)); _angle = (float)Math.Atan2(axis.Y, axis.X); lowerLimit = Loader.loadFloat(data.Attribute("lower_limit"), 0f); upperLimit = Loader.loadFloat(data.Attribute("upper_limit"), 0f); _autoCalculateForce = Loader.loadBool(data.Attribute("auto_calculate_force"), false); _autoForceDifference = Loader.loadFloat(data.Attribute("auto_force_difference"), 0f); _motorSpeed = Loader.loadFloat(data.Attribute("motor_speed"), 0f); _motorEnabled = Loader.loadBool(data.Attribute("motor_enabled"), false); _maxMotorForce = Loader.loadFloat(data.Attribute("max_motor_force"), 0f); initializeControls(); }