- Home /
One More JScript ot C# Question
Thanks for the help guys. I have one more issue and the script is done. How can I change
// This keeps track of our current velocity while we're not grounded?
var inAirVelocity = Vector3.zero;
to C#? I changed it to:
Vector3.zero inAirVelocity;
But it did not work.
Answer by Julien-Lynge · Aug 10, 2011 at 06:28 PM
The syntax is [Type] varName = value; so:
Vector3 inAirVelocity = Vector3.zero;
Answer by foxdanni · Feb 15, 2012 at 02:42 AM
Can anyone can translate the idea of this code to c# :
var ArgumentsCollection = [] ;
var to_TimeOut = null ;
function QueueWorkRunOnce(Argument) {
clearTimeout(to_TimeOut);
ArgumentsCollection.push(Argument) ;
to_TimeOut = setTimeout(/ delegate / function(){
Worker(ArgumentsCollection);
//Reset ArgumentsCollection
ArgumentsCollection = [] ;
},/*Delay in ms*/ 1000 );
}
function Worker(Collection){
alert(Collection.join(" ")) ;
}
onload = function(){
QueueWorkRunOnce("Hi")
//Some other stuff
QueueWorkRunOnce("There")
//Some other stuff
QueueWorkRunOnce("Hello")
QueueWorkRunOnce("World")
//after Xms + 1000ms Will alert("Hi There Hello World") ;
}()
@foxdanni, It appears that somebody already downvoted you for this, and while I won't do the same, I wanted to let you know why: on UnityAnswers, hijacking someone else's question, and posting a question as an answer, are frowned upon. I would suggest posting a new question, and you'll probably have better luck.
Your answer
Follow this Question
Related Questions
Need help converting js to C# -- GUIStyle 2 Answers
Mixing together 2 scripts? 1 Answer
Help converting JavaScipt too c# 1 Answer
JS to C# conversion Problem 1 Answer
Enemy AI script causing Unity to crash (Javascript to C#) 1 Answer