public virtual Vector2 CalculateColorPosition(ColorMarkInfo colorMarkInfo, IMarkInfo markInfo, float markTime, float currentTime, float bpm) { float scale = (float)bpm / DefaultBpm; float timediff = markTime - currentTime; return(OnChangeColorPosition(markInfo, scale, timediff, currentTime, bpm)); }
protected void UpdateColorMarkInfo(ColorMarkInfo colorMarkInfo, IMarkInfo markInfo, float markTime, float currentTime, float bpm, Vector2 vec) { var scale = (float)bpm / DefaultBpm; var timediff = markTime - currentTime; var rot = GetAngle(vec); vec += colorMarkInfo.BasePosition; var tempMat = Matrix.Transformation2D(Vector2.Zero, 0, Vector2.One, Vector2.Zero, timediff >= 0 ? rot : (float)(rot - Math.PI), Vector2.Zero); var vec1 = new Vector2(10, 4 * (float)Math.Cos((Time - currentTime) * scale * Math.PI)); var vec2 = new Vector2(vec1.X, -vec1.Y); vec1 = Vector2.TransformCoordinate(vec1, tempMat) + vec; vec2 = Vector2.TransformCoordinate(vec2, tempMat) + vec; if (colorMarkInfo.VerticesCount == 40) { Array.ConstrainedCopy(colorMarkInfo.Pos1, 1, colorMarkInfo.Pos1, 0, 39); colorMarkInfo.Pos1[39] = vec1; Array.ConstrainedCopy(colorMarkInfo.Pos2, 1, colorMarkInfo.Pos2, 0, 39); colorMarkInfo.Pos2[39] = vec2; } else { colorMarkInfo.Pos1[colorMarkInfo.VerticesCount] = vec1; colorMarkInfo.Pos2[colorMarkInfo.VerticesCount] = vec2; colorMarkInfo.VerticesCount++; } colorMarkInfo.ColorMark.Position = vec; }
public override Vector2 CalculateColorPosition(ColorMarkInfo colorMarkInfo, IMarkInfo markInfo, float markTime, float currentTime, float bpm) { var vec = base.CalculateColorPosition(colorMarkInfo, markInfo, markTime, currentTime, bpm); if (markTime < currentTime) { return(Vector2.Zero); } return(vec); }
public virtual void Initialize(CreateMarkFunc createMark, GetScriptAllowedButtonsFunc getScriptAllowedButtons) { createMark(this, out mark, out GameComponent colorMark, out axis, out GameComponent slideMark, out GameComponent slideColorMark, out PictureObject trace); isMarkCreated = mark != null; mark = mark ?? new PictureObject(device, resourceManager, filenames.GetMarkImagePath(GetButtonType()), true); mark.Scale = Vector2.Zero; colorMark = colorMark ?? new PictureObject(device, resourceManager, filenames.GetMarkColorImagePath(GetButtonType()), true); axis = axis ?? new PictureObject(device, resourceManager, filenames.GetClockAxisImagePath(), true); this.trace = trace ?? new PictureObject(device, resourceManager, filenames.GetTraceImagePath(GetButtonType()), false); colorMarkInfo = new ColorMarkInfo(device, colorMark, Vector2.Zero, this.trace); colorMark.PostDrawManager = postDrawManager; colorMarkInfo.PostDrawManager = postDrawManager; getScriptAllowedButtons(this, out scriptAllowedButtons); this.matrix = Matrix.Transformation2D(Vector2.Zero, 0, Vector2.One, Vector2.Zero, -Angle, Vector2.Zero); Hidden = true; ColorHidden = true; this.AddChild(colorMark); this.AddChild(axis); this.AddChild(mark); this.AddChild(colorMarkInfo); }