private string DeathReasonToString( GoatDeathTypeEnum reason ) { switch ( reason ) { case GoatDeathTypeEnum.RanOffPath: return "RanOffPath"; case GoatDeathTypeEnum.RanOffEdge: return "RanOffEdge"; case GoatDeathTypeEnum.RotatedOffEdge: return "RotatedOffEdge"; case GoatDeathTypeEnum.EdgeBug: return "EdgeBug"; case GoatDeathTypeEnum.ReversedToStart: return "ReversedToStart"; default: return "Unknown"; } }
IEnumerator Die( GoatDeathTypeEnum reason ) { IsDeathCoroutineRunning = true; Debug.Log( "Goat is dead" ); DeathSound.Play(); MoveSound.Stop(); if ( Died != null ) { Died( reason ); } yield return StartCoroutine( RewindWorld() ); IsDeathCoroutineRunning = false; }
private void OnGoatDied( GoatDeathTypeEnum reason ) { // Increment the death counter. Deaths++; // Track the current rotation list, death number, and time. // { "<Level Name>Death", [<Level Name>, <Rotation List>, <Death Number>, <Reason>, <Time>] } if ( IsSendingAnalytics ) { var result = UnityAnalytics.CustomEvent( "Death", new Dictionary<string, object> { { "LevelName", LevelName }, { "Rotations", RotationsToString() }, { "Deaths", Deaths }, { "Reason", DeathReasonToString( reason ) }, { "Time", Time.time } } ); Debug.Log( "\"Death\" Analytics Result: " + result ); } // Clear the current rotation list. Rotations.Clear(); }