public void SetUp() { _game = new Game(); _gameObject = Object.Instantiate(Resources.LoadAssetAtPath("Assets/CarRed.prefab", typeof(GameObject))) as GameObject; if (_gameObject == null) return; _autoBehaviour = _gameObject.AddComponent<CarBehaviour>(); _car = new Car(_autoBehaviour); _gameObjectOther = Object.Instantiate(Resources.LoadAssetAtPath("Assets/CarBlue.prefab", typeof(GameObject))) as GameObject; if (_gameObjectOther == null) return; _gameObjectOther.AddComponent<CarBehaviour>(); _carOther = new Car(_gameObjectOther.GetComponent<CarBehaviour>()); List<Car> cars = new List<Car>(); for (int i = 0; i < GameData.CARS_AMOUNT; i++) { Car c = new Car(_autoBehaviour); cars.Add(c); } MainScript.Cars = cars; MainScript.SelfCar = new Car { CarObject = _autoBehaviour }; }
private void OnServerInitialized() { Game = new Game(); Camera.main.transform.position = new Vector3(0, 0, 10); for (int i = 1; i <= GameData.CARS_AMOUNT; i++) { SpawnPlayer(i); } MainScript.GuiController.Add(GraphicalUIController.ServerConfiguration); }