Пример #1
0
 public void SendWeapon(LegacyWeaponSO wep)
 {
     if (wep != null)
     {
         StartCoroutine(SendData(wep));
     }
 }
Пример #2
0
 private IEnumerator Run()
 {
     while (target.MoveNext())
     {
         result = (LegacyWeaponSO)target.Current;
         yield return(result);
     }
 }
Пример #3
0
    void LevelUp()
    {
        experience -= nextLevelEXP;
        level++;
        float nxt = nextLevelEXP * (2f + ((float)level / 10f));

        Debug.Log(nxt);
        nextLevelEXP           = (int)nxt;
        experienceBar.maxValue = nextLevelEXP;
        UpgradeBaseStats();
        UpdateStats();

        HealOnLvlUp();

        if (equipmentManager.currentWeapon is LegacyWeaponSO)
        {
            LegacyWeaponSO legacy = (LegacyWeaponSO)equipmentManager.currentWeapon;
            legacy.level++;
            legacy.damage += legacy.level;
        }
    }
Пример #4
0
    IEnumerator SendData(LegacyWeaponSO wep)
    {
        string jsonStr = JsonUtility.ToJson(wep, true);

        var uwr = new UnityWebRequest(sendURL, "POST");

        byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes(jsonStr);
        uwr.uploadHandler   = (UploadHandler) new UploadHandlerRaw(jsonToSend);
        uwr.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        uwr.SetRequestHeader("Content-Type", "application/json");
        uwr.chunkedTransfer = false;

        yield return(uwr.SendWebRequest());

        if (uwr.isNetworkError || uwr.isHttpError)
        {
            Debug.Log(uwr.error);
        }
        else
        {
            Debug.Log("Form upload complete! Recieved: " + uwr.downloadHandler.text);
        }
    }