- Home /
Question by
MrMcMister · Aug 19, 2014 at 06:40 AM ·
c#javascript
Need help converting C# to Javascript!
I need help converting two C# Scripts to JavaScript. Here are the codes:
using UnityEngine; using System.Collections;
public class Score : MonoBehaviour {
static int score = 0;
static int highScore = 0;
static public void AddPoint() {
score++;
if(score > highScore) {
highScore = score;
}
}
void Start() {
highScore = PlayerPrefs.GetInt("highScore", 0);
}
void OnDestroy() {
PlayerPrefs.SetInt("highScore", highScore);
}
void Update () {
guiText.text = "Score: " + score + "\nHigh Score: " + highScore;
}
}
using UnityEngine; using System.Collections;
public class ScorePoint : MonoBehaviour {
void OnTriggerEnter(Collider collider) {
if(collider.tag == "Player") {
Score.AddPoint();
gameObject.SetActive(false);
}
}
}
Much appreciated if you can do it! I'm only a modeler and graphics artist lol. Thanks - MrMcMister.
Comment
Why not have a go? You're not going to get very far making a game unless you learn to code or work with a programmer...
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
C# to UnityScript conversion help. 0 Answers
Problem Javascript to C# 3 Answers
dealing with gameObject formations 1 Answer