public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { Convert(entity, dstManager); var table = gameObject.GetComponentInParent <TableBehavior>().Item; transform.GetComponentInParent <Player>().RegisterPlunger(Item, entity, gameObject); Item.Init(table); var hit = Item.PlungerHit; hit.SetIndex(entity.Index, entity.Version); dstManager.AddComponentData(entity, new PlungerStaticData { MomentumXfer = data.MomentumXfer, ScatterVelocity = data.ScatterVelocity, FrameStart = hit.FrameBottom, FrameEnd = hit.FrameTop, FrameLen = hit.FrameLen, RestPosition = hit.RestPos, IsAutoPlunger = data.AutoPlunger, SpeedFire = data.SpeedFire, NumFrames = Item.MeshGenerator.NumFrames }); dstManager.AddComponentData(entity, new PlungerColliderData { JointEnd0 = LineZCollider.Create(hit.JointEnd[0]), JointEnd1 = LineZCollider.Create(hit.JointEnd[1]), LineSegEnd = LineCollider.Create(hit.LineSegEnd), LineSegSide0 = LineCollider.Create(hit.LineSegSide[0]), LineSegSide1 = LineCollider.Create(hit.LineSegSide[1]) }); dstManager.AddComponentData(entity, new PlungerMovementData { FireBounce = 0f, Position = hit.Position, RetractMotion = false, ReverseImpulse = 0f, Speed = 0f, TravelLimit = hit.FrameTop, FireSpeed = 0f, FireTimer = 0 }); dstManager.AddComponentData(entity, new PlungerVelocityData { Mech0 = 0f, Mech1 = 0f, Mech2 = 0f, PullForce = 0f, InitialSpeed = 0f, AutoFireTimer = 0, AddRetractMotion = false, RetractWaitLoop = 0, MechStrength = data.MechStrength }); }
public static void Create(BlobBuilder builder, HitObject src, ref BlobPtr <Collider> dest) { switch (src) { case KickerHit kickerHit: CircleCollider.Create(builder, kickerHit, ref dest, ColliderType.KickerCircle); break; case TriggerHitCircle triggerHitCircle: CircleCollider.Create(builder, triggerHitCircle, ref dest, ColliderType.TriggerCircle); break; case TriggerHitLineSeg triggerHitLine: LineCollider.Create(builder, triggerHitLine, ref dest, ColliderType.TriggerLine); break; case BumperHit bumperHit: CircleCollider.Create(builder, bumperHit, ref dest, ColliderType.Bumper); break; case HitCircle hitCircle: CircleCollider.Create(builder, hitCircle, ref dest); break; case LineSegSlingshot lineSegSlingshot: LineSlingshotCollider.Create(builder, lineSegSlingshot, ref dest); break; case FlipperHit flipperHit: FlipperCollider.Create(builder, flipperHit, ref dest); break; case GateHit gateHit: GateCollider.Create(builder, gateHit, ref dest); break; case LineSeg lineSeg: LineCollider.Create(builder, lineSeg, ref dest); break; case HitLine3D hitLine3D: Line3DCollider.Create(builder, hitLine3D, ref dest); break; case HitLineZ hitLineZ: LineZCollider.Create(builder, hitLineZ, ref dest); break; case HitPoint hitPoint: PointCollider.Create(builder, hitPoint, ref dest); break; case HitPlane hitPlane: PlaneCollider.Create(builder, hitPlane, ref dest); break; case PlungerHit plungerCollider: PlungerCollider.Create(builder, plungerCollider, ref dest); break; case SpinnerHit spinnerHit: SpinnerCollider.Create(builder, spinnerHit, ref dest); break; case HitTriangle hitTriangle: TriangleCollider.Create(builder, hitTriangle, ref dest); break; default: Logger.Warn("Unsupported collider {0}, skipping.", src.GetType().Name); break; } }