Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Error unity error CS0200: Property or indexer `UnityStandardAssets.Characters.FirstPerson.RigidbodyFirstPersonController.Running' cannot be assigned to (it is read only)

$
0
0
public class PlayerController : MonoBehaviour { public float playerHealth = 100f, maxPlayerHealth = 100f, playerStrength = 100f, maxPlayerStrength = 100f, playerHungry = 100f, maxPlayerHungry = 100f, playerThirst = 100f, maxPlayerThirst = 100f; public bool cantRunWithoutStrength = true; public float healthRegeneration = 0.1f, strengthRegeneration = 0.1f, hungryDownspeed = 0.001f, thirstDownspeed = 0.001f, runExpensOfStrength = 0.04f, hungryDamagePerSec = 0.25f, thirstDamagePerSecond = 0.15f; public Image hpBar, strBar, hungBar, thirBar; RigidbodyFirstPersonController fpc; float maxBarLength = 256f; float lastHPTimer = 0f, lastHUNGTimer = 0f, lastTHIRTimer = 0f, lastTHIRSTDamage = 0f, lastHUNGRYDamage = 0f; void Start() { fpc = gameObject.GetComponent(); UpdateBars(); maxBarLength = hpBar.rectTransform.sizeDelta.x; } public void ShowPlayerInfo(bool show) { hpBar.transform.parent.parent.gameObject.SetActive(show); } void Update() { if (!fpc.Running) { playerStrength -= runExpensOfStrength; playerStrength = Mathf.Clamp(playerStrength, 0, maxPlayerStrength); UpdStrength(); } if (cantRunWithoutStrength) { if (playerStrength < 10f) { fpc.Running = false; } else { fpc.Running = true; } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles