// Use this for initialization void Start() { _gameController.showUI(GameUIEnum.GAME); mGuiUpdater = _gameController.getCurrentUI().GetComponent <GUIUpdater>(); mGuiUpdater.setInitialLives(Lives); for (int i = 0; i < Towers.Length; i++) { Towers[i].OnShowCreationGUIEvent += new TowerFactory.ShowCreationGUIHandler(onShowCreationGUI); } _waveController.showFirstWave(); }
// Use this for initialization void Start() { numKills = 0; if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); SetupElements(); }
void Start() { gui = FindObjectOfType <GUIUpdater>(); countDownTime = (float)GameData.Globals["countDownTime"]; }
void update(string msgReceived) { if (GUIUpdater.InvokeRequired) { GUIUpdater.Invoke(new Action(() => update(msgReceived))); } else { GUIUpdater.Text = msgReceived; //decode the msg if (msgReceived[0] == 'I') { string msg = msgReceived.Substring(5); string[] categ = msg.Split(':'); //locate tank tankLocX = 0; tankLocY = 0; tankDirec = 0; pBox[tankLocY][tankLocX].Image = Image.FromFile(@directions[tankDirec]); //Bricks foreach (string coordinate in categ[0].Split(';')) { string[] xy = coordinate.Split(','); int x = (int)Int32.Parse(xy[0]); int y = (int)Int32.Parse(xy[1]); pBox[y][x].BackColor = Color.SandyBrown; } //Stone foreach (string coordinate in categ[1].Split(';')) { string[] xy = coordinate.Split(','); int x = (int)Int32.Parse(xy[0]); int y = (int)Int32.Parse(xy[1]); pBox[y][x].BackColor = Color.DimGray; } //Water foreach (string coordinate in categ[2].Substring(0, categ[2].Length - 1).Split(';')) { string[] xy = coordinate.Split(','); int x = (int)Int32.Parse(xy[0]); int y = (int)Int32.Parse(xy[1]); pBox[y][x].BackColor = Color.DeepSkyBlue; } } else if (msgReceived[0] == 'G') { string msg = msgReceived.Substring(2); string[] categ = msg.Split(':'); foreach (string playerDetails in categ) { if (playerDetails.Substring(0, 2) == "P0") { string[] xy = playerDetails.Substring(3).Split(';'); //geting the location string [] loc = xy[0].Split(','); int x = (int)Int32.Parse(loc[0]); int y = (int)Int32.Parse(loc[1]); //getting the direction int direc = (int)Int32.Parse(xy[1]); //Reset the previous location pBox[tankLocY][tankLocX].Image = null; tankLocX = x; tankLocY = y; tankDirec = direc; pBox[tankLocY][tankLocX].Image = Image.FromFile(@directions[tankDirec]); } } } } }
public void SetUIController(GUIUpdater aGUI) { _GUI = aGUI; }