private void KillPlayer(string reason) { GuiBridge.Instance.ResetDeprivationUX(); var newGrave = new GraveData() { PlayerName = Game.Current.Player.Name, DeathReason = reason, StartSol = Game.Current.Player.SolStart, DeathSol = Game.Current.Environment.CurrentSol }; var newGraves = new GraveData[1] { newGrave }; if (Base.Current.Graves == null) { Base.Current.Graves = newGraves; } else { Base.Current.Graves = Base.Current.Graves.Concat(newGraves).ToArray(); } if (this.OnPlayerDeath != null) { this.OnPlayerDeath(newGrave); } PlayerInput.Instance.KillPlayer(reason); }
private void AddGrave(GraveData grave) { Transform newGrave = GameObject.Instantiate(GraveTemplate, this.transform); newGrave.Translate(Vector3.left * 1.5f * numberOfGraves, Space.Self); string text = grave.PlayerName + "\nSol " + grave.StartSol + " - Sol " + grave.DeathSol + "\n" + grave.DeathReason; newGrave.GetChild(0).GetComponent <TextMesh>().text = text; newGrave.GetChild(1).GetComponent <TextMesh>().text = text; newGrave.gameObject.SetActive(true); numberOfGraves++; }
private void Instance_OnPlayerDeath(GraveData newGrave) { AddGrave(newGrave); }