// public string ToCSVLine() { return(hitType.ToString() + "," + timeImpact + "," + timeEndImpact + "," + back + "," + strength + "," + score + "," + timeTillImpact + "," + orientation + "," + PlayersToString()); }
void CalculateTouchAndSave(Vector2 end, TouchData touchData) { HipHit type = CalculateHitType(end, touchData); if (type == HipHit.INVALID) { return; } Debug.Log("Detected Type: " + type.ToString()); float strength = 0; ushort back = 20; if (type.ToString().StartsWith("CONT")) { back = 100; } float distance = 0.0f; // Calculate Strength based on Distance. if (type.ToString().StartsWith("CIRC")) // Average for Circle { distance = ((touchData.startPos.magnitude + end.magnitude) / 2); } else { distance = end.magnitude; } strength = 5 * (distance / central.y); Debug.Log("Strength Calculated as: " + strength); RhythmLine newLine = new RhythmLine(); newLine.hitType = type; newLine.back = back; newLine.strength = strength; newLine.timeImpact = touchData.startTime; newLine.timeEndImpact = musicSource.time; newLine.score = 20; newLine.timeTillImpact = 1.5f; //newLine.orientation = Orientation.ORIENT_12; newLine.orientation = (Orientation)tempOrient; //looping orientations for testing. tempOrient++; if (tempOrient > (int)Orientation.ORIENT_10_5) { tempOrient = 0; } //-TESTING -End newLine.players = new Players(); newLine.players.Init(); newLine.players.p1 = true; lines.Add(newLine); }