private Vector2 StopEngine() { Flying = false; ReachedCeiling = false; UnitPosition = ProjectionCeiling.TransformInverse(Transform.Position); var FloorPosition = ProjectionFloor.Transform(UnitPosition); FloorPosition = DrawScene.Get <ScenePath>().Path.GetClosestPoint(FloorPosition); return(FloorPosition); }
public void SetPosition(Vector2 position, int mode) { var TransformedPosition = DrawScene.Get <Camera>().TransformInverse(position); var NewPosition = TransformedPosition; if (null == RestrictionPathFloor) { RestrictionPathFloor = CreateRestrictionPathFloor(); } NewPosition = RestrictionPathFloor.GetClosestPoint(TransformedPosition); var Transform = Get <Transform>(); Transform.Position = NewPosition; Get <Interaction>().Position = NewPosition; Transform.Z = NewPosition.Y; }
public void SetPosition(Vector2 position, int mode) { var TransformedPosition = DrawScene.Get <Camera>().TransformInverse(position); if (POSITIONMODE_POSITION == mode) { var NewPosition = TransformedPosition; if (null == RestrictionPathFloor) { RestrictionPathFloor = CreateRestrictionPathFloor(); } NewPosition = RestrictionPathFloor.GetClosestPoint(TransformedPosition); if (null != LineSegmentTarget && null != LineSegmentSource) { var ClosestTarget = LineSegmentTarget.GetClosestPoint(NewPosition); var ClosestSource = LineSegmentSource.GetClosestPoint(NewPosition); WasPlacedTooClose = (ClosestTarget - NewPosition).LengthSquared() <= ALLOWEDDISTANCESQUARED || (ClosestSource - NewPosition).LengthSquared() <= ALLOWEDDISTANCESQUARED; if (!WasPlacedTooClose) { Get <SpriteData>().Color = new Color(0, 0, 1f, 0.3f); } else { Get <SpriteData>().Color = new Color(1f, 0, 0, 0.3f); } } Get <Transform>().Scale = RestrictionPathFloor.GetScale(NewPosition.Y); Get <Transform>().Position = NewPosition; } else { Get <TracerLine>().Target = TransformedPosition; } }