protected void PrepareSimulation(SimulationParameters parameters) { Simulation = new NetworkSimulation(parameters); Connection = Simulation.Connect("InstanceID"); LocalStorage = new LocalStorageSimulation(parameters); Engine = new Engine( new EngineConfiguration { Connection = Connection, LocalStorage = LocalStorage, }); }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { // Position Vector3 _pos = transform.position; stream.SendNext(_pos.x); stream.SendNext(_pos.z); // Rotation stream.SendNext(transform.rotation.eulerAngles.y); // Combat stream.SendNext(bulletsFired); bulletsFired = 0; } else { if (PlayerManager.LocalPlayerPrefab != null && networkSimulation == null) { networkSimulation = PlayerManager.LocalPlayerPrefab.GetComponentInChildren <NetworkSimulation>(); } // Position float posX = (float)stream.ReceiveNext(); float posZ = (float)stream.ReceiveNext(); // Rotation float rotationY = (float)stream.ReceiveNext(); // Combat bulletsFired += (byte)stream.ReceiveNext(); if (networkSimulation != null) { float _packetLoss = networkSimulation.GetPacketLossPercentage() / 100.0f; float _rand = randomNumbers[randomIndex]; randomIndex = (randomIndex + 1) % randomNumbers.Length; if ((1.0f - _packetLoss) > _rand) { previousPosition = transform.position; newPosition = new Vector3(posX, transform.position.y, posZ); previousRotation = transform.rotation; newRotation = Quaternion.Euler(previousRotation.x, rotationY, previousRotation.z); timeSinceLastUpdate = 0; } } } }
public NetworkInterface(NetworkSimulation simulation, DeviceNode devNode) { _simulation = simulation; _devNode = devNode; }
public void BeforeEach() { simulation = new NetworkSimulation(); }
internal SimulatedConnection(SimulationParameters parameters) { simulation = parameters.Simulation; _ServiceState = parameters.ServiceState; }
public HackStartInfo(NetworkSimulation netSim, SaveManager saveManager, Hackable hackable) { _netSim = netSim; _saveManager = saveManager; _hackable = hackable; }