Exemple #1
0
 public EditorTooltipActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _position = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _radius   = Loader.loadFloat(data.Attribute("radius"), 1f);
     _message  = Loader.loadString(data.Attribute("message"), "Default Message");
 }
Exemple #2
0
 public EditorTooltipActor(EditorLevel level)
     : base(level, ActorType.Tooltip, level.getUnusedActorId())
 {
     _position = level.controller.worldMouse;
     _radius   = 1f;
     _message  = "Default Message";
 }
Exemple #3
0
        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();
        }
Exemple #4
0
        public EditorActor(EditorLevel level, XElement data)
        {
            _level = level;

            _type       = (ActorType)Loader.loadEnum(typeof(ActorType), data.Attribute("type"), (int)ActorType.Box);
            _id         = int.Parse(data.Attribute("id").Value);
            _layerDepth = Loader.loadFloat(data.Attribute("layer_depth"), 0f);
        }
 public EditorItemActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _position          = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _itemUID           = data.Attribute("item_uid").Value;
     _quantity          = Loader.loadInt(data.Attribute("quantity"), 1);
     _currentRangeLimit = Loader.loadFloat(data.Attribute("current_range_limit"), 10f);
 }
 public EditorItemActor(EditorLevel level, string itemUID)
     : base(level, ActorType.Item, level.controller.getUnusedActorID())
 {
     _itemUID           = itemUID;
     _quantity          = 1;
     _currentRangeLimit = 10;
     _position          = level.controller.worldMouse;
 }
Exemple #7
0
 public EditorRevoluteActor(EditorLevel level)
     : base(level, ActorType.Revolute, level.controller.getUnusedActorID())
 {
     _position = level.controller.worldMouse;
     initializeControls();
     _selectedA = true;
     _selectedB = true;
     _moveActor = true;
 }
Exemple #8
0
 public EditorRopeActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _doubleAnchor    = Loader.loadBool(data.Attribute("double_anchor"), false);
     _ropeMaterialUID = Loader.loadString(data.Attribute("rope_material_uid"), "default_rope_material");
     _nodeA           = new PointListNode(Loader.loadVector2(data.Attribute("point_a"), Vector2.Zero));
     _nodeB           = new PointListNode(Loader.loadVector2(data.Attribute("point_b"), Vector2.Zero));
     _selectedPoints  = new List <PointListNode>();
 }
 public EditorDecalActor(EditorLevel level)
     : base(level, ActorType.Decal, level.controller.getUnusedActorID())
 {
     _position  = level.controller.worldMouse;
     _decalType = "default_decal";
     textureUid = "default";
     _origin    = Vector2.Zero;
     _angle     = 0f;
 }
 public EditorDecalActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _position  = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _decalType = Loader.loadString(data.Attribute("decal_type"), "default_decal");
     textureUid = Loader.loadString(data.Attribute("texture_uid"), "default");
     _origin    = Loader.loadVector2(data.Attribute("origin"), Vector2.Zero);
     _angle     = Loader.loadFloat(data.Attribute("angle"), 0f);
 }
Exemple #11
0
 public EditorCircuitActor(EditorLevel level, string circuitUID)
     : base(level, ActorType.Circuit, level.controller.getUnusedActorID())
 {
     _circuit     = level.controller.editorController.circuitController.getCircuit(circuitUID);
     _position    = _level.controller.worldMouse;
     _connections = new List <CircuitConnection>();
     _layerDepth  = 0.1f;
     initializeGateControls();
     selectAllGateControls();
 }
        public EditorCollisionFilterActor(EditorLevel level)
            : base(level, ActorType.CollisionFilter, level.getUnusedActorId())
        {
            Vector2 worldMouse = _level.controller.worldMouse;

            _selectedPoints = new List <PointListNode>();
            initializeControls(worldMouse + new Vector2(0f, -0.5f), worldMouse + new Vector2(0f, 0.5f));
            _selectedPoints.Add(_nodeA);
            _selectedPoints.Add(_nodeB);
            _layerDepth = 0.1f;
        }
Exemple #13
0
 public EditorLevelTransitionActor(EditorLevel level)
     : base(level, ActorType.LevelTransition, level.getUnusedActorId())
 {
     _position           = level.controller.worldMouse;
     _halfWidth          = 0.5f;
     _halfHeight         = 0.5f;
     _angle              = 0f;
     _levelUid           = "default";
     _positionInLevel    = Vector2.Zero;
     _requiresActivation = true;
 }
Exemple #14
0
 public EditorLevelTransitionActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _position           = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _halfWidth          = Loader.loadFloat(data.Attribute("half_width"), 0.5f);
     _halfHeight         = Loader.loadFloat(data.Attribute("half_height"), 0.5f);
     _angle              = Loader.loadFloat(data.Attribute("angle"), 0f);
     _levelUid           = Loader.loadString(data.Attribute("level_uid"), "default");
     _positionInLevel    = Loader.loadVector2(data.Attribute("position_in_level"), Vector2.Zero);
     _requiresActivation = Loader.loadBool(data.Attribute("requires_activation"), true);
 }
Exemple #15
0
        public EditorWaypointActor(EditorLevel level)
            : base(level, ActorType.Waypoint, level.getUnusedActorId())
        {
            _selectedPoints = new List <PointListNode>();
            _layerDepth     = 0.1f;
            _uid            = "default_waypoint";

            Vector2 worldMouse = level.controller.worldMouse;

            _headPoint = new PointListNode(worldMouse + new Vector2(-0.5f, 0f));
            _selectedPoints.Add(_headPoint);
            _selectedPoints.Add(_headPoint.tail.insertAfter(worldMouse + new Vector2(0.5f, 0f)));
        }
Exemple #16
0
        public EditorRopeActor(EditorLevel level)
            : base(level, ActorType.Rope, level.controller.getUnusedActorID())
        {
            Vector2 worldMouse = _level.controller.worldMouse;

            _nodeA          = new PointListNode(worldMouse + new Vector2(0f, -0.5f));
            _nodeB          = new PointListNode(worldMouse + new Vector2(0f, 0.5f));
            _selectedPoints = new List <PointListNode>();
            _selectedPoints.Add(_nodeA);
            _selectedPoints.Add(_nodeB);
            _ropeMaterialUID = "default_rope_material";
            _layerDepth      = 0.1f;
        }
Exemple #17
0
 public EditorPrismaticActor(EditorLevel level)
     : base(level, ActorType.Prismatic, level.controller.getUnusedActorID())
 {
     _position            = level.controller.worldMouse;
     _angle               = 0f;
     _lowerLimit          = 0f;
     _upperLimit          = 0f;
     _autoForceDifference = 1f;
     _motorSpeed          = 0f;
     initializeControls();
     _selectedConnectionA = true;
     _selectedConnectionB = true;
     _moveActor           = true;
 }
        public EditorPolygonActor(EditorLevel level, ActorType type)
            : base(level, type, level.controller.getUnusedActorID())
        {
            _selectedPoints = new List <PointListNode>();
            _layerDepth     = 0.1f;

            Vector2 worldMouse = level.controller.worldMouse;

            _headPoint = new PointListNode(worldMouse + new Vector2(0f, -0.5f));
            _selectedPoints.Add(_headPoint);
            _selectedPoints.Add(_headPoint.tail.insertAfter(worldMouse + new Vector2(-0.5f, 0.5f)));
            _selectedPoints.Add(_headPoint.tail.insertAfter(worldMouse + new Vector2(0.5f, 0.5f)));
            triangulate();
        }
 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);
 }
Exemple #20
0
 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 EditorCircleActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _bodyType         = (BodyType)Loader.loadEnum(typeof(BodyType), data.Attribute("body_type"), (int)BodyType.Static);
     _destructible     = Loader.loadBool(data.Attribute("destructible"), false);
     _chunkSpacingX    = Loader.loadFloat(data.Attribute("chunk_spacing_x"), 1f);
     _chunkSpacingY    = Loader.loadFloat(data.Attribute("chunk_spacing_y"), 1f);
     _destructibleSeed = Loader.loadInt(data.Attribute("destructible_seed"), 12345);
     _position         = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _radius           = Loader.loadFloat(data.Attribute("radius"), 1f);
     _density          = Loader.loadFloat(data.Attribute("density"), 0.5f);
     _friction         = Loader.loadFloat(data.Attribute("friction"), 1f);
     _restitution      = Loader.loadFloat(data.Attribute("restitution"), 0f);
     _materialUID      = Loader.loadString(data.Attribute("material_uid"), "default");
 }
 public EditorCircleActor(EditorLevel level)
     : base(level, ActorType.Circle, level.controller.getUnusedActorID())
 {
     _bodyType         = BodyType.Static;
     _destructible     = false;
     _chunkSpacingX    = 1f;
     _chunkSpacingY    = 1f;
     _destructibleSeed = 12345;
     _position         = level.controller.worldMouse;
     _radius           = 1f;
     _density          = 0.5f;
     _friction         = 1f;
     _restitution      = 0f;
     _layerDepth       = 0.1f;
     _materialUID      = "default";
 }
 public EditorTerrainActor(EditorLevel level)
     : base(level, ActorType.Terrain)
 {
     _bodyType         = BodyType.Static;
     _destructible     = false;
     _chunkSpacingX    = 1f;
     _chunkSpacingY    = 1f;
     _chunkJitterX     = 0.2f;
     _chunkJitterY     = 0.2f;
     _destructibleSeed = 12345;
     _density          = 0.5f;
     _friction         = 1f;
     _restitution      = 0f;
     _materialUID      = "default";
     _blockTreeLimbs   = false;
 }
 public EditorPolygonActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _selectedPoints = new List <PointListNode>();
     foreach (XElement pointData in data.Elements("Point"))
     {
         if (_headPoint == null)
         {
             _headPoint = new PointListNode(Loader.loadVector2(pointData, Vector2.Zero));
         }
         else
         {
             _headPoint.tail.insertAfter(Loader.loadVector2(pointData, Vector2.Zero));
         }
     }
     triangulate();
 }
Exemple #25
0
 public EditorWaypointActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _selectedPoints = new List <PointListNode>();
     _uid            = Loader.loadString(data.Attribute("uid"), "default_waypoint");
     foreach (XElement pointData in data.Elements("Point"))
     {
         if (_headPoint == null)
         {
             _headPoint = new PointListNode(Loader.loadVector2(pointData, Vector2.Zero));
         }
         else
         {
             _headPoint.tail.insertAfter(Loader.loadVector2(pointData, Vector2.Zero));
         }
     }
 }
 public EditorTerrainActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _bodyType         = (BodyType)Loader.loadEnum(typeof(BodyType), data.Attribute("body_type"), (int)BodyType.Static);
     _destructible     = Loader.loadBool(data.Attribute("destructible"), false);
     _wall             = Loader.loadBool(data.Attribute("wall"), false);
     _chunkSpacingX    = Loader.loadFloat(data.Attribute("chunk_spacing_x"), 1f);
     _chunkSpacingY    = Loader.loadFloat(data.Attribute("chunk_spacing_y"), 1f);
     _chunkJitterX     = Loader.loadFloat(data.Attribute("chunk_jitter_x"), 0.2f);
     _chunkJitterY     = Loader.loadFloat(data.Attribute("chunk_jitter_y"), 0.2f);
     _destructibleSeed = Loader.loadInt(data.Attribute("destructible_seed"), 12345);
     _density          = Loader.loadFloat(data.Attribute("density"), 0.5f);
     _friction         = Loader.loadFloat(data.Attribute("friction"), 1f);
     _restitution      = Loader.loadFloat(data.Attribute("restitution"), 0f);
     _materialUID      = Loader.loadString(data.Attribute("material_uid"), "default");
     _blockTreeLimbs   = Loader.loadBool(data.Attribute("block_tree_limbs"), false);
 }
Exemple #27
0
        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();
        }
Exemple #28
0
 public EditorTreeActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _angle = Loader.loadFloat(data.Attribute("angle"), 0f);
     _seed  = Loader.loadInt(data.Attribute("seed"), 12345);
     _age   = Loader.loadFloat(data.Attribute("age"), 0f);
     _internodeHalfLength = Loader.loadFloat(data.Attribute("internode_half_length"), 0.5f);
     _maxShootLength      = Loader.loadInt(data.Attribute("max_shoot_length"), 4);
     _maxBaseHalfWidth    = Loader.loadFloat(data.Attribute("max_base_half_width"), 0.25f);
     _perceptionAngle     = Loader.loadFloat(data.Attribute("perception_angle"), 0.6f);
     _perceptionRadius    = Loader.loadFloat(data.Attribute("perception_radius"), 4f);
     _occupancyRadius     = Loader.loadFloat(data.Attribute("occupancy_radius"), 1f);
     _lateralAngle        = Loader.loadFloat(data.Attribute("lateral_angle"), 0.6f);
     _fullExposure        = Loader.loadFloat(data.Attribute("full_exposure"), 1f);
     _penumbraA           = Loader.loadFloat(data.Attribute("penumbra_a"), 1f);
     _penumbraB           = Loader.loadFloat(data.Attribute("penumbra_b"), 2f);
     _optimalGrowthWeight = Loader.loadFloat(data.Attribute("optimal_growth_weight"), 1f);
     _tropismWeight       = Loader.loadFloat(data.Attribute("tropism_weight"), 1f);
     _tropism             = Loader.loadVector2(data.Attribute("tropism"), Vector2.Zero);
     _position            = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _leafMaterialUID     = Loader.loadString(data.Attribute("leaf_material_uid"), "default");
     _barkMaterialUID     = Loader.loadString(data.Attribute("bark_material_uid"), "default");
 }
Exemple #29
0
 public EditorTreeActor(EditorLevel level)
     : base(level, ActorType.Tree, level.controller.getUnusedActorID())
 {
     _angle = 0f;
     _seed  = 12345;
     _age   = 0f;
     _internodeHalfLength = 0.5f;
     _maxShootLength      = 4;
     _maxBaseHalfWidth    = 0.25f;
     _perceptionAngle     = 0.6f;
     _perceptionRadius    = 4f;
     _occupancyRadius     = 1f;
     _lateralAngle        = 0.6f;
     _fullExposure        = 1f;
     _penumbraA           = 1f;
     _penumbraB           = 2f;
     _optimalGrowthWeight = 1f;
     _tropismWeight       = 1f;
     _tropism             = Vector2.Zero;
     _position            = level.controller.worldMouse;
     _layerDepth          = 0.1f;
     _leafMaterialUID     = "default";
     _barkMaterialUID     = "default";
 }
 public EditorEdgeBoundaryActor(EditorLevel level, XElement data)
     : base(level, data)
 {
     _position         = Loader.loadVector2(data.Attribute("position"), Vector2.Zero);
     _edgeBoundaryType = (EdgeBoundaryType)Loader.loadEnum(typeof(EdgeBoundaryType), data.Attribute("edge_boundary_type"), 0);
 }