Example #1
0
    public void HealthShouldDecreaseWhenDamageTaken()
    {
        int damageAmount  = 10;
        int initialHealth = _playerHealthManager.GetHealth();

        _playerHealthManager.TakeDamage(damageAmount);
        UUnitAssert.Equals(_playerHealthManager.GetHealth(), initialHealth - damageAmount, "Health not decreased correctly");
    }
    DropOffReq getCurentState()
    {
        int    health = hpManager.GetHealth();
        string token  = PlayerPrefs.GetString("user_token");

        DropOffPoint dropOffPointData = new DropOffPoint();

        dropOffPointData.position     = player.transform.position;
        dropOffPointData.rotation     = player.transform.rotation;
        dropOffPointData.playerHealth = health;
        dropOffPointData.deathCount   = hpManager.DeathCount;
        dropOffPointData.gotKey       = playerController.hasKey.ToString().ToUpper();
        dropOffPointData.gameFinished = playerController.gameFinished.ToString().ToUpper();

        DropOffReq reqData = new DropOffReq();

        reqData.token = token;
        reqData.point = dropOffPointData;

        return(reqData);
    }
Example #3
0
    public void CollectItem(GameObject item)
    {
        CollectibleController collController = item.GetComponent <CollectibleController>();

        if (collController != null)
        {
            switch (collController.collectibleType.ToString())
            {
            case "Health":
                if (playerHealthManager.GetHealth() == 100)
                {
                    return;
                }
                break;

            default:
                break;
            }
            item.SetActive(false);
            photonView.RPC("RPCCollectItem", RpcTarget.AllViaServer, collController.collectibleType.ToString(), collController.photonView.ViewID, photonView.ViewID);
        }
    }