public void SetUp()
        {
            _gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
            _networkController = _gameObject.AddComponent<NetworkController>();
            _carBehaviour = _gameObject.AddComponent<CarBehaviour>();
            _server = _gameObject.AddComponent<Server>();
            NetworkView = new Mock<INetworkView>();
            _networkController.NetworkView = NetworkView.Object;
            _carBehaviour.NetworkView = NetworkView.Object;

            MainScript.NetworkController = _networkController;
        }
Пример #2
0
        void Update()
        {
            if (Environment == Environment.PC && Input.GetKeyDown(KeyCode.Delete))
            {
                NetworkController.CloseClient();
                Application.Quit();
            }

            if (!NetworkController.IsServer())
            {
                return;
            }
            binding.CheckForInput();
        }
Пример #3
0
        public void OnAdvanceScrollInput()
        {
            if (scrollDirection == 0)
            {
                return;
            }
            scrollTimer -= Time.deltaTime * 1000;
            if (scrollTimer <= 0)
            {
                LoadNewConnectedNodeSet(NodeController.SelectedNode, FilterSelectedNodeSet);
                NetworkController.SyncConnectionScrolled(scrollDirection);

                SeriesScrolls++;
                ResetTimer();
            }
        }
Пример #4
0
        private void Start()
        {
            Connections.Pool = new GameObjectPool(Connections.Prefab, Connections.PreloadNumber, Connections.PoolContainer);

            if (NetworkController.IsServer())
            {
                NetworkController.BeforeConnectionModeSync  += mode => LoadNewConnectedNodeSet(NodeController.SelectedNode, FilterSelectedNodeSet, true, mode);
                NetworkController.BeforeSelectedNodeSync    += node => LoadNewConnectedNodeSet(node, FilterSelectedNodeSet, true);
                NetworkController.BeforeHighlightedNodeSync += node => LoadNewConnectedNodeSet(node, FilterHighlightedNodeSet);
            }
            NodeController.OnSelectedNodeChanged          += (oldNode, newNode) => ReloadSelectedNodeConnections(newNode);
            GraphController.ConnectionMode.OnValueChanged += mode => ReloadSelectedNodeConnections(NodeController.SelectedNode);
            NodeController.OnHighlightedNodeChanged       += OnHighlightedNodeChanged;

            ConnectionLoadManager = new ConnectionLoadManager(this);
        }
Пример #5
0
        void Start()
        {
            if (Environment == Environment.Cave)
            {
                Flysticks[0].GetComponent <LineRenderer>().enabled = ShowFlystickRays;
            }

            if (!NetworkController.IsServer())
            {
                return;
            }
            InputProcessor input = GetEnvDependent((InputProcessor) new PCInputProcessor(PCConfig, PCInputBinding, this),
                                                   new CaveInputProcessor(CaveConfig, CaveInputBinding, this));

            binding = GetEnvDependent((InputBinding)PCInputBinding, CaveInputBinding);

            CaveInputBinding.SetPrimaryFlystick(0);
            binding.Init();
            SetBlockInput(true, InputBlockType.INFO_SPACE);
        }
Пример #6
0
        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));
        }
Пример #7
0
 private void Awake()
 {
     networkController = GetComponent <NetworkController>();
 }
Пример #8
0
 void Awake()
 {
     nodeController    = GetComponent <NodeController>();
     graphController   = GetComponent <GraphController>();
     networkController = GetComponent <NetworkController>();
 }