static void ActivatePlayer() { // Activate player only once. if (player != null) { player.Gui.IsInventoryOpen = false; player.Gui.IsMenuOpen = false; return; } // Activate camera movement cameraControl = new FreeCameraControl(-10f, camera); // Configure the camera to receive user input. Input.RootGroup.AddListener(cameraControl); // Create particle entity. ParticleEntity = new AnonymousEntity(mat4.Identity); world.AddEntity(ParticleEntity, Network.GCManager.CurrentUserID); // Create the Player EntityScript and add it to the world. // For now, place him 30 meters above the ground and let him drop to the ground. player = new Player(camera); world.AddEntity(player, mat4.Translate(new vec3(0, 50f, 0)), Network.GCManager.CurrentUserID); // Register the update callback that updates the camera position. Scripting.RegisterUpdateFunction(Update, 1 / 60f, 3 / 60f); // Register save callback Savegame.OnSave += s => { player.Save(); UpvoidMinerWorldGenerator.SaveEntities(); }; }
public bool UpdateAnon(AnonymousEntity anonToUpdate) { _ctx.AnonymousEntity.Attach(anonToUpdate); _ctx.Entry(anonToUpdate).State = EntityState.Modified; return(Save()); }
public bool AddAnonymousUser(AnonymousEntity addNewAnon) { _ctx.AnonymousEntity.Add(addNewAnon); return(Save()); }