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.

3 Answers

3

The syntax is [Type] varName = value;
so:

Vector3 inAirVelocity = Vector3.zero;

Vector3 inAirVelocity = Vector3.zero;

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.