public static Animatable2 CreateRect(RectParams rp, MotionParams mp = new MotionParams()) { var p = CreatePlane(rp.scale, rp.rotation); p.localScale = rp.scale; p.position = rp.position; // must come after position p.level = rp.level; p.velocity = mp.velocity; p.color = rp.color; return(p); }
void _Box(Vector2 scale, Vector2 pos, Color color, float rotation, float level) { var lp = new LineParams2 { position = pos, color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams(); NoteFactory.CreateLine(lp, mp); }
void _FixedLine(float width, float xOffset, Color color, float level) { var scale = new Vector2(width, CameraHelper.Height * 2); var lp = new LineParams2 { position = new Vector2(CameraHelper.Width * xOffset - CameraHelper.HalfWidth, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams(); NoteFactory.CreateLine(lp, mp); }
void AnimateRect(Direction dir, float speed, Vector2 scale, Color color, Vector2 position, float rotation = 0, float level = 0) { var lp = new LineParams2 { position = position, color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; NoteFactory.CreateLine(lp, mp); }
void AnimateRect(Direction dir, float speed, Vector2 scale, Color color, float offset = 0, float rotation = 0, float level = 0) { var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, offset, scale, rotation), color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; NoteFactory.CreateLine(lp, mp); }
void _Box(Vector2 scale, Vector2 pos, Color color, float rotation, float level) { var lp = new LineParams2 { position = pos, color = color, scale = scale, rotation = rotation, level = level }; var mp = new MotionParams(); var anim = NoteFactory.CreateLine(lp, mp); anim.DestroyIn(BeatDurationInSeconds * destroyInMeasures * 4); }
void _Line(Direction dir, float height, float offset, float deltaSpeed = 0) { var scale = dir.Align(new Vector2(defaultLineWidth, height * (Random.value * 0.7f + 0.65f))); var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, offset, scale, 0), color = lineColor, scale = scale, rotation = 0, level = ShapeZLevel.Front }; var mp = new MotionParams { velocity = dir.ToVelocity(defaultLineSpeed + deltaSpeed) }; NoteFactory.CreateLine(lp, mp); }
void _Line2(Direction dir, float width, float height, float offset, float speed, Color color, float level) { var scale = new Vector2(width, height); var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, 0, scale, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; NoteFactory.CreateLine(lp, mp); }
void _FixedLine(float width, float xOffset, Color color, float level) { var scale = new Vector2(width, CameraHelper.Height * 2); var lp = new LineParams2 { position = new Vector2(CameraHelper.Width * xOffset - CameraHelper.HalfWidth, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams(); var anim = NoteFactory.CreateLine(lp, mp); anim.DestroyIn(BeatDurationInSeconds * destroyInMeasures * 4); }
public static Animatable2 CreateRectInViewport(float x, float y, float width, float height, Color color, float rotation = 0, float level = 0, Vector2 velocity = new Vector2()) { var position = CameraHelper.ViewportToWorldPoint(x, y); var scale = CameraHelper.ViewportToWorldScale(width, height); var lp = new RectParams { position = position, scale = scale, color = color, rotation = rotation, level = level }; var mp = new MotionParams { velocity = velocity }; return(CreateRect(lp, mp)); }
void _Line(Direction dir, float width, float speed, Color color, float level) { var scale = new Vector2(width, CameraHelper.Height * 2); var lp = new LineParams2 { position = CameraHelper.PerimeterPositionForMovingObject(dir, 0, scale, 0), color = color, scale = scale, rotation = 0, level = level }; var mp = new MotionParams { velocity = dir.ToVelocity(speed) }; var anim = NoteFactory.CreateLine(lp, mp); anim.DestroyIn(BeatDurationInSeconds * destroyInMeasures * 4); }
public static Animatable2[] CreateLine(SplineParams sp, MotionParams mp = new MotionParams()) { int parts = 1400; var anims = new Animatable2[parts]; for (int i = 0; i < parts; i++) { float t = i / (float)parts; var p = sp.spline.GetPoint(t); var d = sp.spline.GetDirection(t); var v = sp.spline.GetVelocity(t); var anim = CreateRect(new RectParams { width = v.magnitude / 15, color = sp.color, position = p, height = sp.width * v.magnitude / 15, rotation = d.AngleInDegrees() }); anims[i] = anim; } return(anims); //return null;//p.gameObject.AddComponent<Animatable2>(); //return CreateRect(lp.ToRectParams(), mp); }
public static Animatable2 CreateLine(LineParams2 lp, MotionParams mp = new MotionParams()) { return(CreateRect(lp.ToRectParams(), mp)); }