Would anyone be so kind as to help me convert this script to c#?
var cols:int = 4;
var rows:int = 4;
var totalCards:int = cols*rows;
var matchesNeededToWin:int = totalCards * 0.5;
var matchesMade:int = 0;
var cardW:int = 100;
var cardH:int = 100;
var aCards:Array;
var aGrid:Array;
var aCardsFlipped:ArrayList;
var playerCanClick:boolean;
var playerHasWon:boolean = false;
function Start()
{
playerCanClick = true;
aCards = new Array();
aGrid = new Array();
aCardsFlipped = new ArrayList();
for(i=0; i<rows; i++)
{
aGrid *= new Array();*
- for(j=0; j<cols; j++)*
- {*
_ aGrid*[j] = new Card();_
_ }_
_ }_
_}*_
function OnGUI ()
{
* GUILayout.BeginArea (Rect (0,0,Screen.width,Screen.height));*
* BuildGrid();*
* GUILayout.EndArea();*
* print(“building grid!”);*
}
function BuildGrid()
{
GUILayout.BeginVertical();
for(i=0; i<rows; i++)
{
GUILayout.BeginHorizontal();
for(j=0; j<cols; j++)
{
var card:Object = aGrid*[j];*
if(GUILayout.Button(Resources.Load(card.img),
GUILayout.Width(cardW)))
{
Debug.Log(card.img);
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
class Card extends System.Object
{
* var isFaceUp:boolean = false;*
* var isMatched:boolean = false;*
* var img:String;*
function Card()
{
img = “robot”;
}
}