Convert js to c#

Could any one plz help me I need to convert this code over to c# so I can add it into the script I already have. I know c# but I an not full sure of the conversions from js to c#.

enter code herevar shield : GameObject;
var timer = 60;
var cooldown = 0;


function Update () 
{
	
	
	if(Input.GetKey(KeyCode.S))
	{
	Shield();
	}

}
function Shield ()

{
	if(cooldown <= 0)
	{
    shield.active = true;
	yield WaitForSeconds(60);
	shield.active = false;
	cooldown = 2;
	
	}
	
	else if (cooldown >1)
	{
	 yield WaitForSeconds(10);
	 cooldown = 0;
	}

}

You really don’t have any code that is different from what c# would use . . .

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
float Timer ;
GameObject shield ;
float cool ;
    function Update () 
{


    if(Input.GetKey(KeyCode.S))
    {
    Shield();
    }

}
void Shield ()

{
    if(cooldown <= 0)
    {
    shield.active = true;
    yield WaitForSeconds(60);
    shield.active = false;
    cooldown = 2;

    }

    else if (cooldown >1)
    {
     yield WaitForSeconds(10);
     cooldown = 0;
    }

}
}


PS: I am not able to test this code out, but, it's at least the basis for what you are asking . Fix any issues Unity3D might bring up, though your code is simple/straightforward enough that I didn't catch any errors.

Welcome . Feel free to hit Thumbs up :slight_smile: