Пример #1
0
 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();
 }
Пример #2
0
 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));
 }
Пример #3
0
        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;
        }
Пример #4
0
 public void SetLinkedCollisionBox(CollisionBox newCollisionBox)
 {
     linkedCollisionBox = newCollisionBox;
     SetSensorDetails();
 }
Пример #5
0
 public static CollisionBox CreateFromData(CollisionBoxData data)
 {
     CollisionBox collisionBox = new CollisionBox(data.height, data.width, data.offset);
     return collisionBox;
 }