IEnumerator RunSquareBeats() { Color[] colors = { orange, red, purple }; System.Action MakeShape = () => { var randomColor = Color.Lerp(red, blue, Random.Range(0.5f, 1f)); var anim = NoteFactory.CreateRectInViewport( x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: Random.Range(0.06f, 0.13f), height: Random.Range(0.12f, 0.20f), color: randomColor, level: ShapeZLevel.Back / 1000f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat, 1, Beat * 3, 1, Beat * 4, 0 ); anim.DestroyIn(Beat * 6); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; // until measure 40 foreach (var rest in Loop(64, 0, 0, 1)) { MakeShape(); yield return(rest); } }
IEnumerator RunCircles() { Color[] colors = { orange, red, purple }; System.Action MakeCircle = () => { var randomColor = Color.Lerp(peach, blue, Random.Range(0.0f, 0.5f)); var diameter = CameraHelper.Height * Random.Range(0.7f, 0.8f); var cp = new CircleProperty(color: randomColor, diameter: diameter, center: CameraHelper.RandomPositionNearCenter(diameter / 2)); var anim = NoteFactory.CreateCircle(cp); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat * 4, 1, Beat * 6, 1, Beat * 8, 0 ); anim.DestroyIn(Beat * 9); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; // until measure 40 foreach (var rest in Loop(64, 0, 2, 0)) { MakeCircle(); yield return(rest); } }
IEnumerator RunShapes4() { yield return(Rest(24)); foreach (var i in Times(1000)) { foreach (var _ in Times(1)) { var randomColor = Color.Lerp(orange, red, Random.value); // closer to red var anim = NoteFactory.CreateRectInViewport( x: 0.5f, y: Random.Range(0, 10) / 10f, width: 0.7f, height: 0.1f, color: randomColor, rotation: Random.value * 360); var maxOpacity = Random.Range(0.5f, 1f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat, maxOpacity, Beat * 2, maxOpacity, Beat * 3, 0 ); anim.DestroyIn(Beat * 4); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); } yield return(Rest(0, 4f)); } }
IEnumerator RunHorizontalLines() { yield return(Rest(8)); System.Action MakeShape = () => { var randomColor = Color.Lerp(orange, red, Random.value); // closer to red var anim = NoteFactory.CreateRectInViewport( x: 0.5f, y: Random.Range(0, 10) / 10f, width: 1f, height: 0.03f, color: randomColor); var maxOpacity = Random.Range(0.7f, 1f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat * 2, maxOpacity, Beat * 6, maxOpacity, Beat * 8, 0 ); Debug.Log(anim.position); anim.DestroyIn(Beat * 10); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; foreach (var rest in Loop(32, 0, 0, 2)) { MakeShape(); yield return(rest); } yield return(Rest(8)); foreach (var rest in Loop(16, 0, 0, 2)) { MakeShape(); yield return(rest); } }
IEnumerator RunDiagonalLines() { System.Action MakeShape = () => { var randomColor = Color.Lerp(darkBlue, blue, Random.value); // closer to red var anim = NoteFactory.CreateRectInViewport( x: Random.value, y: Random.value, width: Random.Range(0.2f, 0.5f), height: 0.001f, color: randomColor, rotation: Random.value * 360); var maxOpacity = Random.Range(0.5f, 1f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat, maxOpacity, Beat * 20, maxOpacity, Beat * 30, 0 ); anim.DestroyIn(Beat * 40); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; foreach (var rest in Loop(16, 0, 0, 4)) { MakeShape(); yield return(rest); } yield return(Rest(8)); foreach (var rest in Loop(16, 0, 0, 2)) { MakeShape(); yield return(rest); } }
IEnumerator RunCircles() { System.Action MakeCircle = () => { var randomColor = colors.Shuffle().First(); var diameter = CameraHelper.Height * Random.Range(0.7f, 0.8f); var cp = new CircleProperty(color: randomColor, diameter: diameter, center: CameraHelper.RandomPositionNearCenter(diameter / 2)); var anim = NoteFactory.CreateCircle(cp); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat * 1, randomColor.a, Beat * 7, randomColor.a, Beat * 8, 0 ); anim.DestroyIn(Beat * 9); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; // until measure 40 foreach (var rest in Loop(100000000, 0, 2, 0.25f)) { MakeCircle(); yield return(rest); } }
void Start() { songLines = new Queue <string>(); nf = gameObject.GetComponent <NoteFactory>(); loadSong(@".\Assets\Test Songs\TestSong.txt"); playSong(); }
IEnumerator RunSquareBeats() { //Color[] colors = {orange, red, purple}; float[] heights = { 0.08f, 0.2f, 0.13f }; System.Action MakeShape = () => { var randomColor = colors.Shuffle().First(); //var randomColor = Color.Lerp(red, blue, Random.Range(0.5f, 1f)); var randHeight = RandomHelper.Pick(heights); var anim = NoteFactory.CreateRectInViewport( x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: randHeight / 1.6f, height: randHeight, color: randomColor, level: ShapeZLevel.Back / 1000f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat, randomColor.a, Beat * 6f, randomColor.a, Beat * 7, 0 ); anim.DestroyIn(Beat * 8); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; // until measure 40 foreach (var rest in Loop(10000000, 0, 2, 1)) { MakeShape(); yield return(rest); } }
IEnumerator RunDiagonalLines() { System.Action MakeShape = () => { //var randomColor = Color.Lerp(orange, red, Random.value); // closer to red var randomColor = colors.Shuffle().First(); var anim = NoteFactory.CreateRectInViewport( x: 0.5f, y: Random.Range(0, 10) / 10f, width: 0.7f, height: 0.1f, color: randomColor, rotation: Random.value * 360); var maxOpacity = Random.Range(1f, 1f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat, randomColor.a, Beat * 2, randomColor.a, Beat * 3, 0 ); anim.DestroyIn(Beat * 4); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; foreach (var rest in Loop(1000000, 0, 1, 2)) { MakeShape(); yield return(rest); } }
IEnumerator CreateLine2() { var sp = new SplineParams(); sp.spline = new BezierSpline2D( RV(), RV(), RV(), RV()); sp.spline.AddCurve(RV(), RV(), RV()); sp.spline.AddCurve(RV(), RV(), RV()); sp.spline.AddCurve(RV(), RV(), RV()); sp.color = Color.Lerp(blue, red, Random.value).WithAlpha(0); sp.width = Random.Range(0.02f, 0.2f); Animatable2[] anims = NoteFactory.CreateLine(sp); foreach (var l in anims) { l.AddAnimationCurve(AnimationKeyPath.Opacity, AnimationCurve.Linear(0, 0, 1, 1)); yield return(new WaitForSeconds(0.01f)); } yield return(new WaitForSeconds(2f)); foreach (var l in anims) { //l.velocity = RandomHelper.RandomVector2(-0.5f, 0.5f, -0.5f, 0.5f); //l.angularVelocity = Random.Range(-90f, 90f); l.AddAnimationCurve(AnimationKeyPath.Opacity, AnimationCurve.EaseInOut(0, 1, 3, 0)); l.DestroyIn(4f); } }
IEnumerator RunBackground() { System.Action MakeShape = () => { var randomColor = Color.Lerp(Color.white, lightBeige, Random.Range(0.8f, 1f)); var anim = NoteFactory.CreateRectInViewport( x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: Random.Range(0.46f, 0.63f), height: Random.Range(0.42f, 0.60f), color: randomColor, level: ShapeZLevel.Back / 1000f); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat * 8, Random.Range(0.8f, 0.9f), Beat * 16, Random.Range(0.8f, 0.9f), Beat * 32, 0 ); anim.DestroyIn(Beat * 33); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; // until measure 40 foreach (var rest in Loop(64, 0, 1, 0)) { MakeShape(); yield return(rest); } }
IEnumerator RunClock() { System.Action MakeShape = () => { var randomColor = Color.Lerp(lightBlue, darkBlue, Random.Range(0f, 1f)); var anim = NoteFactory.CreateRectInViewport( x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: 0.02f, height: 0.9f, color: randomColor, level: ShapeZLevel.Front); Keyframe[] kff = KeyframeHelper.CreateKeyframes( 0, 0, Beat * 4, 1, Beat * 8, 1, Beat * 12, 0 ); anim.pivot = new Vector2(0, -1.5f); //anim.velocity = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)); anim.angularVelocity = 15f; anim.DestroyIn(Beat * 13); anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff)); }; // until measure 40 foreach (var rest in Loop(64, 0, 0, 8)) { MakeShape(); yield return(rest); } }
/// <summary> /// Gets the collection of all <see cref="INote"/> /// </summary> /// <param name="keys"> /// The keys. /// </param> /// <returns> /// The <see cref="IEnumerable{INote}"/>. /// </returns> protected override IEnumerable <INote> PerformGetAll(params Guid[] keys) { var dtos = new List <NoteDto>(); if (keys.Any()) { // This is to get around the WhereIn max limit of 2100 parameters and to help with performance of each WhereIn query var keyLists = keys.Split(400).ToList(); // Loop the split keys and get them foreach (var keyList in keyLists) { dtos.AddRange(Database.Fetch <NoteDto>(GetBaseQuery(false).WhereIn <NoteDto>(x => x.Key, keyList, SqlSyntax))); } } else { dtos = Database.Fetch <NoteDto>(GetBaseQuery(false)); } var factory = new NoteFactory(); foreach (var dto in dtos) { yield return(factory.BuildEntity(dto)); } }
void Start() { laser = GetComponentInParent <LaserBehaviour>(); chart = laser.chart; trackToVisualize = laser.trackIndex; keysToVisualize = laser.assignedPitches; tiltAngle = Vector3.Angle(transform.rotation * Vector3.up, Vector3.up); factory = GetComponent <NoteFactory>(); particles = GetComponentInChildren <ParticleSystem>(); if (keysToVisualize == null || keysToVisualize.Length == 0) { foreach (var note in chart.tracks[trackToVisualize].notes) { pendingNotes.Enqueue(note); } } else { var keySet = new HashSet <int>(keysToVisualize); foreach (var note in chart.tracks[trackToVisualize].notes) { if (keySet.Contains(note.noteNum)) { pendingNotes.Enqueue(note); } } } }
public void NoteFinderTest() { NoteFactory noteFactory = new NoteFactory(); NoteFinder noteFinder = new NoteFinder(noteFactory); INote note = noteFactory.CreateNote(enote, octave); var actual = noteFinder.FindNearestNote(110); Assert.AreEqual(actual, note); }
public Song() { name = ""; key = NoteFactory.getNoteByName("C"); lyrics = new Lyric(); rhythm = new Rhythm(4, 4); mode = ModeFactory.getModeByName("Major"); musicalElements = new List <IMusicalElement>(); }
public void Fill(Color color) { Rect rect = currZoomToWorldScale; var rp = new RectParams { position = rect.center, scale = rect.size, level = zoomStack.Count, color = color }; var r = NoteFactory.CreateRect(rp); //rect = NodeFactory.CreateRect( }
private static Note calculateNote(int distance, Note _key) { int next = _key.getValue() + distance; if (next > 12) { next = next - 12; } return(NoteFactory.getNoteByValue(next, _key)); }
public void Initialize(GridRect rect, Board1 board) { //Debug.Log($"Creating GraphicEntity: {rect}"); this.board = board; this.rect = rect; board.LockTiles(rect, this); var rectParams = board.GridRectToRectParams(rect); animatable = NoteFactory.CreateRect(rectParams); }
/// <summary> /// Updates a note /// </summary> /// <param name="entity"> /// The entity. /// </param> protected override void PersistUpdatedItem(INote entity) { ((Entity)entity).UpdatingEntity(); var factory = new NoteFactory(); var dto = factory.BuildDto(entity); Database.Update(dto); entity.ResetDirtyProperties(); }
public void CanConstructNoteFactory() { // ARRANGE // ACT var subjectUnderTest = new NoteFactory(); // ASSERT Assert.That(subjectUnderTest, Is.TypeOf(typeof(NoteFactory))); Assert.That(subjectUnderTest, Is.InstanceOf(typeof(INoteFactory))); }
/// <summary> /// Persist new note. /// </summary> /// <param name="entity"> /// The entity. /// </param> protected override void PersistNewItem(INote entity) { ((Entity)entity).AddingEntity(); var factory = new NoteFactory(); var dto = factory.BuildDto(entity); Database.Insert(dto); entity.Key = dto.Key; entity.ResetDirtyProperties(); }
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 Start() { NoteFactory.CreateCircle(new CircleProperty()); StartCoroutine(RunLineIntro()); // StartCoroutine(RunShapes()); StartCoroutine(RunShapes2()); StartCoroutine(RunShapes3()); StartCoroutine(RunShapes4()); StartCoroutine(RunRisingGraph()); StartCoroutine(RunCamera()); StartCoroutine(RunCameraZoom()); //StartCoroutine(RunCameraPosition()); }
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); }
public void CreateThrowsArgumentExceptionWhenTextNull() { // ARRANGE var expectedExceptionMessage = "Must have text to create note. (Parameter 'text')"; var subjectUnderTest = new NoteFactory(); // ACT // ASSERT var ex = Assert.Throws <ArgumentException>( () => subjectUnderTest.Create(null) ); Assert.That(ex.Message, Is.EqualTo(expectedExceptionMessage)); }
public void CanCreateNote() { // ARRANGE var expectedNoteText = "This is just a reminder to go to the store."; var subjectUnderTest = new NoteFactory(); // ACT var result = subjectUnderTest.Create(expectedNoteText); // ASSERT Assert.That(result, Is.Not.Null); Assert.That(result, Is.InstanceOf(typeof(INote))); Assert.That(result.Text, Is.EqualTo(expectedNoteText)); }
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 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); }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (Input.anyKeyDown) { index++; cosc.transform.localScale = new Vector3(2, 2, 2); AddNote(NoteFactory.PlayNote(Random.Range(0, 20), secondsPer)); } playingNotes.RemoveAll(x => x.IsDead()); foreach (Note note in playingNotes) { note.Update(); } }