IEnumerator HPGauge() { int HP = PlayerDataManagement.Singleton().NowPlayerData.Health; HpG.value = HP; HPTxt.text = "HP " + HP.ToString() + "/" + "100"; yield return(null); }
void Update() { if (PlayerDataManagement.Singleton().life != true) { Debug.Log(PlayerDataManagement.Singleton().life); On_Respawn(); } }
public void Save() { Vector3 Pos = Player.transform.position; string position = Pos.x.ToString() + '/' + Pos.y.ToString() + '/' + Pos.z.ToString(); PlayerDataManagement.Singleton().NowPlayerData.Health = 100; PlayerDataManagement.Singleton().NowPlayerData.SavePos = position; PlayerDataManagement.Singleton().SaveData(); }
void PlayerCreate() { GameObject tmpObj = null; string[] spos = PlayerDataManagement.Singleton().NowPlayerData.SavePos.Split('/'); Vector3 tmpPos = new Vector3(float.Parse(spos[0]), float.Parse(spos[1]), float.Parse(spos[2])); Debug.Log(tmpPos); tmpObj = Instantiate(Player, tmpPos, Quaternion.identity) as GameObject; }
void On_Respawn() { float spawnTime = 3.0f; PlayerDataManagement.Singleton().NowPlayerData.Health = 100; PlayerDataManagement.Singleton().life = true; while (spawnTime < 0) { spawnTime = spawnTime - Time.deltaTime; } Reset.SetActive(PlayerDataManagement.Singleton().life); }
void OnCollisionEnter(Collision col) { int HP = PlayerDataManagement.Singleton().NowPlayerData.Health; int Critical = Random.Range(3, 9); if (col.gameObject.CompareTag("Enemy")) { PlayerDataManagement.Singleton().NowPlayerData.Health = HP - (PlayerDataManagement.Singleton().NowPlayerData.Damage + (PlayerDataManagement.Singleton().NowPlayerData.Health / Critical)); if (PlayerDataManagement.Singleton().NowPlayerData.Health < 0) { PlayerDataManagement.Singleton().life = false; obj.SetActive(PlayerDataManagement.Singleton().life); } } }
private void OnTriggerEnter(Collider col) { int damage = PlayerDataManagement.Singleton().NowPlayerData.Damage; Respawn rsp = new Respawn(); if (col.tag == "Attack") { if (HP <= 0) { OnDestroy(); HP = 100.0f; } HP = HP - damage; Debug.Log(HP); } }
public void OnClickOk() { PlayerDataManagement.Singleton().CreateData(SetName.text); }
public void OnClickLoadButton() { PlayerDataManagement.Singleton().LoadData(); }