void OnTriggerEnter2D(Collider2D col){ | |
if(Globals.playIsDoing == Globals.PlayerIsDoing.Idle) | |
return; | |
if(col.WithPlayer() && !activated){ | |
Time.captureFramerate = saveScreenshotFrameRate; | |
instance = this; | |
instance.SetSaveUnitData(); | |
instance.activated = true; | |
StartCoroutine(instance.SaveCheckPoint()); | |
StartCoroutine(instance.TakeScreenshot()); | |
} | |
} | |
IEnumerator SaveCheckPoint(){ | |
yield return null; | |
SerializerUtils.SaveCheckPointAsJSON(instance.data, persistentPath, Globals.currentLevel, number); | |
instance.number = number; | |
instance.LoadCheckPoint(Globals.currentLevel,number); | |
} | |
IEnumerator TakeScreenshot(){ | |
//Save Screenshot of the Level | |
var directory = Path.Combine (persistentPath, "CheckPoint"); | |
var destination = Path.Combine(directory,string.Format("Level_{0}_{1}.png", | |
Globals.currentLevel,number)); | |
Application.CaptureScreenshot(destination, 1); | |
yield return new WaitForSeconds(0.3f); | |
Time.captureFramerate = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment