Please Convert Following Code Python Using Unityengine Using Systemcollections Using Unity Q43811958
Please convert the following code to Python.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour {
public float CurrentHealth;
public float MaxHealth;
public Slider thisSlider;
public float CurrentLvl;
public float StartLvl;
public Text DisplayLvl;
// Use this for initialization
void Start () {
MaxHealth = 50f;
CurrentHealth = MaxHealth – MaxHealth;
StartLvl = 0f;
CurrentLvl = StartLvl;
thisSlider.value = CalcHealth ();
DisplayLvl = GetComponent<Text> ();
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(“n”))
{
CurrentHealth = CurrentHealth + 5;
thisSlider.value = CalcHealth ();
}
if (CurrentHealth >= MaxHealth) {
CurrentHealth = 0f;
CurrentLvl = CurrentLvl + 1;
}
DisplayLvl.text = CurrentLvl.ToString ();
}
float CalcHealth()
{
return CurrentHealth / MaxHealth;
}
float GetLvl() {
return CurrentLvl;
}
}
Expert Answer
Answer to Please convert the following code to Python. using UnityEngine; using System.Collections; using UnityEngine.UI; public c…
OR