Question by
Dylanpolis · Aug 11, 2017 at 02:33 AM ·
c#javascriptscript.scripting beginnerscriptingbasics
Could someone translate these to c#?
var ani : Animator;
var sound: AudioClip;
function Start () {
ani.enabled = false;
}
function OnTriggerEnter () {
AudioSource.PlayClipAtPoint(sound, transform.position);
ani.enabled = true;
Destroy(gameObject);
}
and this
#pragma strict
var NewScene : String;
function OnTriggerEnter(Col : Collider)
{
if(Col.tag ==("Player"))
{
Application.LoadLevel(NewScene);
}
}
Comment
public String NewScene;
void OnTriggerEnter(Collider Col)
{
if(Col.tag ==("Player"))
{
Application.LoadLevel(NewScene);
}
}
Beginner questions should be posted into the Help Room. Please read the FAQ.
I'll move the question into the help room.
Best Answer
Answer by Komayo · Aug 11, 2017 at 02:57 AM
public Animator ani;
public AudioClip sound;
void Start () {
ani.enabled = false;
}
void OnTriggerEnter () {
AudioSource.PlayClipAtPoint(sound, transform.position);
ani.enabled = true;
Destroy(gameObject);
}
This inside a script class. Something like this, you get the idea.
Thanks! could you list the new scene one too ? Im trying to learn c# and this way has been working!
Its above, on reply to your comment. After the code.
public String NewScene;
void OnTriggerEnter(Collider Col)
{
if(Col.tag ==("Player"))
{
Application.LoadLevel(NewScene);
}
}
Your answer
Follow this Question
Related Questions
Need help to put together 2 scripts 0 Answers
Need to Change this script function , please 0 Answers
Need help in translating javascript code into c#. 1 Answer
How do I make a enter and exit car script? 0 Answers
Trying to make a Parkour Platformer! 0 Answers