void FixedUpdate() { if (!StaticVariables.gameStarts) { status.currMP = 0; status.currHP = status.getMaxHP(); } //Debug.Log("static flags = (" + StaticVariables.gameStarts + "," + StaticVariables.gameIsOver +","+ stoppedBySkill + ")"); if (!StaticVariables.gameStarts || StaticVariables.gameIsOver || stoppedBySkill || stunned) { stopRunning(); return; } startRunning(); }
// Update is called once per frame void Update() { float maxWidth = 2; float width = maxWidth; if (car != null) { if (isHPBar) { width *= (carStatus.getHP() / carStatus.getMaxHP()); } else { width *= (carStatus.getMP() / carStatus.getMaxMP()); } } width = Mathf.Clamp(width, 0, 2); rectTransform.sizeDelta = new Vector2(width, rectTransform.sizeDelta.y); }