I'm programming a script so that if my player enters the water, they will respawn at their start location, and play an audio clip. However, I want to add lava to that function, so that if they enter lava or the water, they'll respawn and play the audio clip, all in one script attached to the first person controller.
I have very little programming experience, but I took a class in high school and remember if, then, but I want to know if there's an "or," or equivalent function.
Here's my script.
var respawnSound: AudioClip;
var respawnPosition : Vector3;
static var respawnCount : int = 0;
function Awake () {
respawnPosition = transform.position;
}
function OnTriggerEnter(otherGameObject : Collider) {
if (otherGameObject.name=="Daylight Simple Water") {
transform.position = respawnPosition;
audio.PlayOneShot (respawnSound);
respawnCount++;
}
}
I was hoping to just add an "or" or something equivalent under the if line, then just add (otherGameObject.name=="Lava") { and then let the script continue as above, instead of making two separate scripts.
How can I get this to work? Thanks.