public void UpdateAnalytics(ObstacleType obstacleType, int distance, int collectedSparks, float timeSpent) { // Analytics obstacleAnalytics[obstacleType.ToString()]++; if (maxReachedDistance < distance) { maxReachedDistance = distance; } if (maxCollectedSparks < collectedSparks) { maxCollectedSparks = collectedSparks; } m_cumulativeTime += timeSpent / 60; // Achievements if (m_cumulativeTime > m_timeAchievement) { timeAchieved.Invoke(); } if (distance > m_distanceAchievement) { distanceAchieved.Invoke(); } if (collectedSparks > m_sparksAchievement) { sparksAchieved.Invoke(); } // Add parameters to dictionary which will be sent to Unity Analytics parameters["Obstacle Type"] = obstacleType.ToString(); parameters["Distance Reached"] = distance; parameters["Sparks Collected"] = collectedSparks; // Check for tilt or button control and add that parameter to dictionary if (touchButtons.activeSelf) { parameters["Controls Used"] = "Buttons"; } else { parameters["Controls Used"] = "Tilt"; } // Send Event AnalyticsResult result = AnalyticsEvent.Custom(eventName, parameters); if (result == AnalyticsResult.Ok) { Debug.Log("Analytics sent"); } else { Debug.Log("Analytics not sent"); } }
public string GetDefinitionObjects() { string message = ""; message += name + " - " + type.ToString(); return(message); }
public void UpdateName(bool holeCase = false) { if (holeCase == false) { if (xEnd == 0) { name = myType.ToString() + "_" + xInit.ToString(); } else { name = myType.ToString() + "_[" + xInit.ToString() + ", " + xEnd.ToString() + "]"; } } else { name = "HOLE_JUST_INIT_X"; } //Debug.Log ("name: " + name); }
public TreadmillSegment(float speed, ObstacleType obstacle, ref TreadmillUpdate treadmillUpdater) { Speed = speed; Segment = Instantiate(Resources.Load(obstacle.ToString()) as GameObject); treadmillUpdater += TreadmillUpdated; StepSize = (int)(1 / Speed); Step = Segments * StepSize; Segments++; }
public static GameObject GetObstaclePrefab(ObstacleType type) { string path = string.Empty; path = System.IO.Path.Combine("Prefabs", "Obstacle"); path = System.IO.Path.Combine(path, "Obstacle_" + type.ToString()).Replace("\\", "/"); GameObject go = GetPrefab(path); return go; }
public static GameObject Fetch(ObstacleType type) { if (templateCache.ContainsKey(type)) { return(templateCache[type]); } GameObject template = Resources.Load <GameObject>("Obstacle/" + type.ToString()); templateCache.Add(type, template); return(template); }
public static void AppendPattern(ObstacleType obstacle) { string previousPattern = ReadPattern(); /* previous string might be like "Treadmill_Center" since we */ /* trim the trailing \n */ string newPattern = previousPattern + "\n" + obstacle.ToString(); /* this adds a new "Treadmill_Left + "\nTreadmill_Center" */ /* to the end of the previous string */ string filePath = ProjectPath + "\\pattern.txt"; // filePath = C:\Users\[user name]\Documents\BookContents\Chapters\Chapter7\pattern.txt StreamWriter writer = new StreamWriter(filePath); writer.Write(newPattern); writer.Close(); }
public override string ToString() { string res = ""; res += type.ToString(); res += " " + model_id + "|" + part_id; res += " " + (Common.MsgId)action; res += " (" + radius + ")"; res += " [" + coeffs[0] + " " + coeffs[1] + " " + coeffs[2] + " " + coeffs[3] + " " + coeffs[4] + " " + coeffs[5] + " " + coeffs[6] + " " + coeffs[7] + " " + coeffs[8] + "]"; return(res); }
/// <summary> /// Gets color representation of the obstacle in blueprint. /// </summary> public static string GetObstacleColor(ObstacleType pObstacle) { var attributes = XmlParser.GetAttributesValues("Obstacles", pObstacle.ToString()); return attributes["Color"]; }