Exemplo n.º 1
0
    IEnumerator HPGauge()
    {
        int HP = PlayerDataManagement.Singleton().NowPlayerData.Health;

        HpG.value  = HP;
        HPTxt.text = "HP " + HP.ToString() + "/" + "100";
        yield return(null);
    }
Exemplo n.º 2
0
 void Update()
 {
     if (PlayerDataManagement.Singleton().life != true)
     {
         Debug.Log(PlayerDataManagement.Singleton().life);
         On_Respawn();
     }
 }
Exemplo n.º 3
0
    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();
    }
Exemplo n.º 4
0
    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;
    }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
    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);
            }
        }
    }
Exemplo n.º 7
0
    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);
        }
    }
Exemplo n.º 8
0
 public void OnClickOk()
 {
     PlayerDataManagement.Singleton().CreateData(SetName.text);
 }
Exemplo n.º 9
0
 public void OnClickLoadButton()
 {
     PlayerDataManagement.Singleton().LoadData();
 }