how to translate a script from java to C#?

hi! i need to call some variables of a C#-script, but i can only program in java. if i link the script in the javascript, i will get an error. so could anyone please help me to write this simple code in C#? i tried first with converters, but it did not work. so i tried by myself, but failed. thank you so much!!

var time : float = 0.0;
var forwards : booleand = true;

function Update () {

var cookieScript : AnimateCookieTexture = GetComponent(AnimateCookieTexture);
time += Time.deltaTime;
if (time > 1)
{
time = 0;
cookieScript.fps = ((Random.value * 10)+10);
}
if (cookieScript.frameNr > (cookieScript.texture.Lenght-1) && forwards)
{
forwards = false;
cookieScript.animMode = backwards;
}
if (cookieScript.frameNr > (cookieScript.texture.Lenght-1) && forwards == false)
{
forward = true;
cookieScript.animMode = forwards;
}
}

it is possible to use both languages, but the way they compile means that they only work one way i.e. C# gets compiled before JS, JS can see C# but C# cannot see JS :

http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html => point 3

http://answers.unity3d.com/questions/208383/referencing-a-c-component-script-from-js-script.html

http://answers.unity3d.com/questions/243112/calling-c-classes-from-js.html

Here’s some links I found useful in converting between C# and JS :

http://answers.unity3d.com/questions/12911/what-are-the-syntax-differences-in-c-and-javascrip.html

http://www.unifycommunity.com/wiki/index.php?title=Which_Kind_Of_Array_Or_Collection_Should_I_Use?