private void CreateWorld() { network = new LiteNetLibNetwork(); networkCommandQueue = new NetworkCommandQueue(network); networkCommandQueue.InitReceived += (sender, init) => { rand = new Random(init.Seed); for (int i = 0; i < 100; i++) { var mushroom = scene.CreateChild("Mushroom"); mushroom.Position = new Vector3(rand.Next(90) - 45, 0, rand.Next(90) - 45); mushroom.Rotation = new Quaternion(0, rand.Next(360), 0); mushroom.SetScale(0.5f + rand.Next(20000) / 10000.0f); var mushroomObject = mushroom.CreateComponent <StaticModel>(); mushroomObject.Model = ResourceCache.GetModel("Models/Mushroom.mdl"); mushroomObject.SetMaterial(ResourceCache.GetMaterial("Materials/Mushroom.xml")); } simulation.Start(init.SimulationSpeed, init.ActorID, init.AllActors); }; simulation = new Simulation(Contexts.sharedInstance, networkCommandQueue, new ViewService(ResourceCache, scene.GetChild("Jacks"))); network.Start(); network.Connect("127.0.0.1", 9050); }
protected override void Setup() { SetupLogger(); gameState = Add <GameState>(); onlineManager = Add <LiteNetLibNetwork>(); onlineManager.Start(gameState); Add <OnlineProcessor>(); Add <ClickMoveProcessor>(); Add <UnitSelectionProcessor>(); Add <SpawnProcessor>(); Add <MoveProcessor>(); Add <SelectionProcessor>(); Add <DebugInputProcessor>(); //Add<DynamicNavProcessor>(); }