i am newer to Unity but far from new to programming. I am trying to check (and reset if the scenario arises) the current position of a character. I have checked numerous boards and the problem is always that someone spelled GameObject gameObject and I am confident that is not the problem… any ideas?
#pragma strict
private var health : int = 0;
var maxHealth : int = 10;
private var isDead : boolean = false;
//var playerPos : Vector3 = playerObject.transform.position;
//set the players current health to a new value, if a negative is input then
//default the health to 0.
function setHealth(health : int) {
if (health <= 0) {
this.health = health;
}
else if (health >= maxHealth) {
this.health = maxHealth;
}
}
function Reset() {
GameObject.Transform.x = 11.38105;
GameObject.Transform.y = 0.8;
GameObject.Transform.z = -1.680236;
}
function update() {
if (this.health == 0) {
this.isDead = true;
}
if (gameObject.transform.y <= 0) {
this.isDead = true;
}
if (this.isDead == true) {
Reset(gameObject);
}
}
Thanks