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 : => point 3

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