public SpikeTrap() { FixedOrigin = new SpatialComponent(this); TargetSensor = new TargetSensorComponent(this) { SensorType = TargetSensorType.Rectangle, TargetCollisionCategories = CollisionCategory.Friendly, }; TargetSensor.AttachTo(FixedOrigin); MovingBodyComponent = new BodyComponent(this) { InitMode = BodyComponentInitMode.Manual, }; RootComponent = MovingBodyComponent; Animation = new SpriteAnimationComponent(this) { AnimationTypes = new List <SpriteAnimationType> { SpriteAnimationType.Shopkeeper_Idle_Front }, }; Animation.AttachTo(this); }
public Gate() { LeftEdgeOffset = new SpatialComponent(this); { SpriteAnimationData anim = SpriteAnimationFactory.GetAnimation(SpriteAnimationType.Gate_Closed); Vector2 hotspot = anim.Config.Hotspot * anim.Config.Scale; float offset = Conversion.ToMeters(hotspot.X - 128); LeftEdgeOffset.Spatial.Position.X -= offset; } LeftEdgeOffset.AttachTo(this); InnerBodyComponent = new BodyComponent(this) { InitMode = BodyComponentInitMode.Manual, }; InnerBodyComponent.AttachTo(LeftEdgeOffset); OuterBodyComponent = new BodyComponent(this) { InitMode = BodyComponentInitMode.Manual, }; OuterBodyComponent.AttachTo(LeftEdgeOffset); Trigger = new BodyComponent(this) { InitMode = BodyComponentInitMode.Manual, }; Trigger.AttachTo(this); Animation = new SpriteAnimationComponent(this) { AnimationTypes = new List <SpriteAnimationType> { SpriteAnimationType.Gate_Closed, SpriteAnimationType.Gate_Open, }, }; Animation.AttachTo(this); }