public void SetUp() { _gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube); _client = _gameObject.AddComponent<Client>(); Network = new Mock<INetwork>(); NetworkView = new Mock<INetworkView>(); _client.NetworkView = NetworkView.Object; _client.Network = Network.Object; _gameObjectGui = GameObject.CreatePrimitive(PrimitiveType.Cube); _gameObjectGui.AddComponent<GraphicalUIController>(); _gameObjectGui.tag = "GUI"; MainScript.GuiController = (GraphicalUIController)GameObject.FindGameObjectWithTag("GUI").GetComponent(typeof(GraphicalUIController)); }
public void Initialize() { Server = (Server)GameObject.FindGameObjectWithTag("Network").GetComponent(typeof(Server)); Client = (Client)GameObject.FindGameObjectWithTag("Network").GetComponent(typeof(Client)); // Use the NetworkWrapper so that the Server maintains it's actual functionallity. Server.Network = new NetworkWrapper(); Cars = new List<Car>(); for (int i = 0; i < GameData.CARS_AMOUNT; i++) { Cars.Add(new Car()); } NetworkController = (NetworkController)GameObject.FindGameObjectWithTag("Network").GetComponent(typeof(NetworkController)); GuiController = (GraphicalUIController)GameObject.FindGameObjectWithTag("GUI").GetComponent(typeof(GraphicalUIController)); CountdownController = (CountdownController)GameObject.FindGameObjectWithTag("CountdownController").GetComponent(typeof(CountdownController)); }