private void OnTriggerEnter(Collider other) { if (wasActivated) { return; } wasActivated = true; PlayParticles(); towerScript.RemovePart(); if (other.tag == "Player") { switch (numberOfPiecesRemoved) { case 0: Achievement_Manager.Set_FIRST_PART(); break; case 1: Achievement_Manager.Set_SECOND_PART(); break; case 2: Achievement_Manager.Set_THIRD_PART(); break; case 3: Achievement_Manager.Set_LAST_PART(); break; } } RemoveMiniatureTowerPart(); }
{ //This Script Serialised the achievements public static void AchievementSave(Achievement_Manager achievement) { BinaryFormatter formatter = new BinaryFormatter(); string path = Path.Combine(Application.persistentDataPath, "/achievement.lel"); //path combine just makes the file locations safer in some mobile platforms, creates file FileStream stream = new FileStream(path, FileMode.Create); //creates the file on the harddrive in a random location Achievement_data data = new Achievement_data(achievement); //pass in the achievement data values, initilaise achievement data. formatter.Serialize(stream, data); //converts achievment data into binary while placing inside the stream, aka the file. stream.Close(); //close the file }
public static void Respawn(GameObject objectToRespawn, RespawnInfo respawnInfo) { objectToRespawn.transform.position = respawnInfo.RespawnPosition; Rigidbody rb = objectToRespawn.GetComponent <Rigidbody>(); if (rb != null) { rb.velocity = Vector3.zero; } respawnInfo.RespawnEffect.PlayOnce(); Achievement_Manager.Set_RESPAWN(); }
private void UpdateAchievement() { if (finished && allStatues) { TimeSpan elapsedSpan = new TimeSpan(finishTime.Ticks - speedrunStart.Ticks); if (elapsedSpan.Minutes <= 12) { Achievement_Manager.Set_TWELVE_MINUTES(); } if (elapsedSpan.Minutes <= 10) { Achievement_Manager.Set_TEN_MINUTES(); } if (elapsedSpan.Minutes <= 8) { Achievement_Manager.Set_EIGHT_MINUTES(); } } }
public bool framevalue3; //storing frame value of second frame public Achievement_data(Achievement_Manager achievement) { framevalue1 = achievement.isWinAchievement1; framevalue2 = achievement.isWinAchievement2; framevalue3 = achievement.isWinAchievement3; }