public CollisionSensor(CollisionBox linkedCollisionBox, SensorType sensorType, int sensorDepth) : base(0, 0, Vector2.Zero, Color.Blue) { this.linkedCollisionBox = linkedCollisionBox; this.sensorType = sensorType; this.sensorDepth = sensorDepth; SetSensorDetails(); }
public RectangleWall(string textureFileName, Vector2 position, Vector2 velocity, int topCollisionOffset, int totalFrames, bool behindScenery) : base(textureFileName, position, velocity, totalFrames, ObstacleType.RectangleWall, behindScenery) { collisionBox = new CollisionBox(Sprite.FrameHeight - topCollisionOffset, Sprite.FrameWidth, new Vector2(0, topCollisionOffset / 2)); collisionSensors.Add(SensorType.Top, new CollisionSensor(collisionBox, SensorType.Top, 10)); collisionSensors.Add(SensorType.Bottom, new CollisionSensor(collisionBox, SensorType.Bottom, 10)); collisionSensors.Add(SensorType.Left, new CollisionSensor(collisionBox, SensorType.Left, 5)); collisionSensors.Add(SensorType.Right, new CollisionSensor(collisionBox, SensorType.Right, 5)); }
public static CollisionBoxData ConvertToData(CollisionBox collisionBox) { CollisionBoxData data = new CollisionBoxData(); data.height = collisionBox.rectangle.Height; data.width = collisionBox.rectangle.Width; data.offset = collisionBox.offset; return data; }
public void SetLinkedCollisionBox(CollisionBox newCollisionBox) { linkedCollisionBox = newCollisionBox; SetSensorDetails(); }
public static CollisionBox CreateFromData(CollisionBoxData data) { CollisionBox collisionBox = new CollisionBox(data.height, data.width, data.offset); return collisionBox; }