int CalculateMonobeat(Sequence.Wall wall, Passage.Step step) { int measure = Mathf.FloorToInt(wall.Measure); int beat = Mathf.RoundToInt((wall.Measure - measure) * 10); return(CalculateMonobeat(measure, beat) + ((step == null)? 0 : step.Beat)); }
void AddToTargetMap(Sequence.Wall wall, Passage.Step step, TargetController target) { int key = CalculateMonobeat(wall, step); if (!TargetMap.ContainsKey(key)) { TargetMap.Add(key, new List <TargetController>()); } TargetMap[key].Add(target); }
Vector2 MakeTarget( Sequence sequence, Sequence.Wall wall, WallController wallController, Passage.Step step, Transform drawingPlane, Vector2 position, float size, Vector2 last) { GameObject target = Instantiate(TargetPrefab, drawingPlane); TargetController targetController = target.GetComponent <TargetController>(); wallController.Targets.Add(targetController); targetController.Step = step; targetController.HitClip = sequence.HitSound; targetController.MissClip = sequence.MissSound; targetController.Update(position, size, last); target.name = step.Beat + " left"; AddToTargetMap(wall, step, targetController); return(position); }