// Update is called once per frame void Update() { if (TP_Animator.Instance.IsDead) { if (firstCallDead) { time = Time.time; firstCallDead = false; } if (player.GetComponent <Rigidbody>().velocity.Equals(Vector3.zero) && Time.time - time >= 3.0f) { firstCallDead = true; BodyInfo info = new BodyInfo(player.transform.position, gc.CurrentLevel); if (Bodys != null) { Bodys.Add(info); } else { Bodys = new List <BodyInfo>(); Bodys.Add(info); } if (Graves == null || Graves.Count == 0) { Save.PlayerPosition = DefaultPosition; Debug.Log(DefaultPosition); gc.CurrentLevel = 2; } else { gc.CurrentLevel = Graves.Peek().Level; Save.PlayerPosition = new Vector3(Graves.Peek().PositionX, Graves.Peek().PositionY, Graves.Peek().PositionZ); } TP_Animator.Instance.Reset(); SceneManager.LoadScene("loading"); } } }