public void CreateFlag() { var clothGrid = new ClothTestGrid(10, 10); using (var physics = CreatePhysicsAndScene()) { Cooking cooking = physics.Physics.CreateCooking(); ClothMeshDesc clothMeshDesc = new ClothMeshDesc() { Points = clothGrid.Points, Triangles = clothGrid.Indices }; MemoryStream stream = new MemoryStream(); bool result = cooking.CookClothFabric(clothMeshDesc, new Vector3(0, -9.81f, 0), stream); ClothFabric clothFabric = physics.Physics.CreateClothFabric(stream); ClothParticle[] particles = clothGrid.Points.Select(p => new ClothParticle(p, 2)).ToArray(); ClothCollisionData collision = new ClothCollisionData(); Cloth cloth = physics.Physics.CreateCloth(Matrix.Identity, clothFabric, particles, collision, 0); } }
public void CreateFlag() { var clothGrid = new ClothTestGrid(10, 10); using (var physics = CreatePhysicsAndScene()) { using (Cooking cooking = physics.Physics.CreateCooking()) { var clothMeshDesc = new ClothMeshDesc() { Points = clothGrid.Points, Triangles = ArrayUtil.ToByteArray(clothGrid.Indices) }; MemoryStream stream = new MemoryStream(); cooking.CookClothFabric(clothMeshDesc, new Vector3(0, -9.81f, 0), stream); // After cooking the fabric, we must put the position of the written stream back to 0 // so that it can be read from the beginning in the CreateClothFabric method stream.Position = 0; ClothFabric clothFabric = physics.Physics.CreateClothFabric(stream); ClothParticle[] particles = clothGrid.Points.Select(p => new ClothParticle(p, 2)).ToArray(); Cloth cloth = physics.Physics.CreateCloth(Matrix4x4.Identity, clothFabric, particles, 0); } } }
public override void Unload() { if (!Main.dedServ) { customResources = null; customResources2 = null; customResources3 = null; customResources4 = null; customResources5 = null; customResources6 = null; stamina = null; collection = null; overlay = null; infusion = null; cooking = null; linkhp = null; VitricBackgroundDust.Clear(); VitricForegroundDust.Clear(); CursedAccessory.Bootlegdust.Clear(); BlessedAccessory.Bootlegdust.Clear(); BlessedAccessory.Bootlegdust2.Clear(); Collection.Bootlegdust.Clear(); Overlay.Bootlegdust.Clear(); Instance = null; Dash = null; Superdash = null; Float = null; Smash = null; Purify = null; } }
public static TriangleMesh CreateTriangleMesh(Vector3[] positions, int[] indices, StillDesign.PhysX.Scene scene) { TriangleMeshDescription triangleMeshDesc = new TriangleMeshDescription(); triangleMeshDesc.AllocateVertices <Vector3>(positions.Length); triangleMeshDesc.AllocateTriangles <int>(indices.Length); // int indices, should be short but whatever triangleMeshDesc.VerticesStream.SetData(positions); triangleMeshDesc.TriangleStream.SetData(indices); triangleMeshDesc.VertexCount = positions.Length; triangleMeshDesc.TriangleCount = indices.Length / 3; System.IO.MemoryStream stream = new System.IO.MemoryStream(); Cooking.InitializeCooking(); Cooking.CookTriangleMesh(triangleMeshDesc, stream); Cooking.CloseCooking(); stream.Position = 0; return(scene.Core.CreateTriangleMesh(stream)); }
// Use this for initialization void Start() { InitMinerData(); // Hay que hacer la fsm del agente fsm = new FSM(gameObject, this); // Crear los estados en que puede estar Cooking cook = new Cooking(this); Bathroom bath = new Bathroom(this); Housework work = new Housework(this); // Asignarle a cada estado los eventos que puede tener //work.AddEvent(EventList.events.imHome); // Hay que agregarlos a la FSM fsm.AddState(StateID.Cooking, cook); fsm.AddState(StateID.Bathroom, bath); fsm.AddState(StateID.DoHousework, work); // Indicar cual es el estado inicial fsm.ChangeState(StateID.DoHousework); // Activo la fsm fsm.Activate(); }
public IActionResult Create(CreateViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var cook = this._context.Cookings.FirstOrDefault(c => c.Name == model.Name); if (cook == null) { var cooking = new Cooking { Id = Guid.NewGuid(), Name = model.Name, UpdatedAt = DateTime.UtcNow, CreatedAt = DateTime.UtcNow, }; this._context.Cookings.Add(cooking); this._context.SaveChanges(); } else { ModelState.AddModelError("", "Name has already used"); return(View(model)); } return(RedirectPermanent("Index")); }
private MemoryStream cookTriangleMeshStream(MeshCollisionData.TriangleMeshData model, Matrix transform) { TriangleMeshDescription triangleMeshDesc = new TriangleMeshDescription(); triangleMeshDesc.AllocateVertices <Vector3>(model.Positions.Length); triangleMeshDesc.AllocateTriangles <int>(model.Indices.Length); // int indices, should be short but whatever Vector3[] transformedPositions = new Vector3[model.Positions.Length]; Vector3.Transform(model.Positions.ToArray(), ref transform, transformedPositions); triangleMeshDesc.VerticesStream.SetData(model.Positions.ToArray()); triangleMeshDesc.TriangleStream.SetData(model.Indices.ToArray()); triangleMeshDesc.VertexCount = model.Positions.Length; triangleMeshDesc.TriangleCount = model.Positions.Length / 3; System.IO.MemoryStream stream = new System.IO.MemoryStream(); Cooking.InitializeCooking(); Cooking.CookTriangleMesh(triangleMeshDesc, stream); Cooking.CloseCooking(); stream.Position = 0; return(stream); }
private ConvexMesh loadConvexMesh(MeshCollisionData.Convex convexData, StillDesign.PhysX.Scene scene) { // Allocate memory for the points and triangles var convexMeshDesc = new ConvexMeshDescription() { PointCount = convexData.Positions.Count }; convexMeshDesc.Flags |= ConvexFlag.ComputeConvex; convexMeshDesc.AllocatePoints <Vector3>(convexData.Positions.Count); // Write in the points and triangles // We only want the Position component of the vertex. Also scale down the mesh for (int i = 0; i < convexData.Positions.Count; i++) { convexMeshDesc.PointsStream.Write(convexData.Positions[i]); } // Cook to memory or to a file MemoryStream stream = new MemoryStream(); //FileStream stream = new FileStream( @"Convex Mesh.cooked", FileMode.CreateNew ); Cooking.InitializeCooking(new ConsoleOutputStream()); Cooking.CookConvexMesh(convexMeshDesc, stream); Cooking.CloseCooking(); stream.Position = 0; return(scene.Core.CreateConvexMesh(stream)); }
public PhysxPhysicWorld(Vector3 gravity, bool connectToRemoteDebugger = false) { physix = new PhysX.Physics(new ErrorCallbackImp(), true); var sceneDesc = new SceneDesc() { Gravity = gravity.AsPhysX() }; scene = physix.CreateScene(sceneDesc); this.scene.SetVisualizationParameter(VisualizationParameter.Scale, 1.0f); this.scene.SetVisualizationParameter(VisualizationParameter.CollisionShapes, true); this.scene.SetVisualizationParameter(VisualizationParameter.JointLocalFrames, true); this.scene.SetVisualizationParameter(VisualizationParameter.JointLimits, true); this.scene.SetVisualizationParameter(VisualizationParameter.ParticleSystemPosition, true); this.scene.SetVisualizationParameter(VisualizationParameter.ActorAxes, true); // Connect to the remote debugger if it's there if (connectToRemoteDebugger) { physix.ConnectToRemoteDebugger("localhost"); } objs = new List <IPhysicObject>(); ctns = new List <IPhysicConstraint>(); cooking = physix.CreateCooking(); }
public override void OnDelayedWorldLoadFinished() { Overwatch.Log("CleanupKnownRecipes"); foreach (SimDescription sim in Household.EverySimDescription()) { if (sim.SkillManager == null) { continue; } Cooking skill = sim.SkillManager.GetSkill <Cooking>(SkillNames.Cooking); if (skill == null) { continue; } if (skill.KnownRecipes == null) { continue; } foreach (string recipe in new List <string>(skill.KnownRecipes)) { if (!Recipe.NameToRecipeHash.ContainsKey(recipe)) { skill.KnownRecipes.Remove(recipe); Overwatch.Log(" Removed " + recipe + ": " + sim.FullName); } } } }
public ClothModel(GraphicFactory factory, PhysxPhysicWorld PhysxPhysicWorld, ClothMeshDescription clothMeshDesc, XNA.Vector3[] Points, XNA.Vector2[] TextCoords, int[] Indices, String diffuseTextureName = null) : base(factory, "Cloth", false) { this._diffuseName = diffuseTextureName; VerticesNum = Points.Length; IndicesNum = Indices.Length; clothMeshDesc.AllocateVertices <Vector3>(VerticesNum); clothMeshDesc.AllocateTriangles <int>(IndicesNum / 3); clothMeshDesc.VertexCount = VerticesNum; clothMeshDesc.TriangleCount = IndicesNum / 3; BatchInformation = new PloobsEngine.Modelo.BatchInformation(0, VerticesNum, IndicesNum / 3, 0, 0, VertexPositionNormalTexture.VertexDeclaration, VertexPositionNormalTexture.VertexDeclaration.VertexStride, PrimitiveType.TriangleList); BatchInformation.ModelLocalTransformation = XNA.Matrix.Identity; vertexPositionNormalTexture = new VertexPositionNormalTexture[VerticesNum]; BatchInformation.VertexBuffer = factory.CreateDynamicVertexBuffer(VertexPositionNormalTexture.VertexDeclaration, VerticesNum + (int)(1.2 * VerticesNum), BufferUsage.WriteOnly); BatchInformation.IndexBuffer = factory.CreateDynamicIndexBuffer(IndexElementSize.ThirtyTwoBits, IndicesNum + (int)(1.2 * IndicesNum), BufferUsage.WriteOnly); BatchInformation.IndexBuffer.SetData <int>(Indices); clothMeshDesc.VerticesStream.SetData(Points); clothMeshDesc.TriangleStream.SetData(Indices); for (int i = 0; i < BatchInformation.NumVertices; i++) { vertexPositionNormalTexture[i].TextureCoordinate = TextCoords[i]; vertexPositionNormalTexture[i].Position = Points[i]; } // We are using 32 bit integers for our indices, so make sure the 16 bit flag is removed. // 32 bits are the default, so this isn't technically needed, but it's good to show in a sample clothMeshDesc.Flags &= ~MeshFlag.Indices16Bit; //clothMeshDesc.Flags |= (MeshFlag)((int)clothMeshDesc.Flags | (int)ClothMeshFlag.Tearable); // Write the cooked data to memory using (var memoryStream = new MemoryStream()) { Cooking.InitializeCooking(); Cooking.CookClothMesh(clothMeshDesc, memoryStream); Cooking.CloseCooking(); // Need to reset the position of the stream to the beginning memoryStream.Position = 0; ClothMesh = PhysxPhysicWorld.Core.CreateClothMesh(memoryStream); } modelRadius = Microsoft.Xna.Framework.BoundingSphere.CreateFromPoints(Points).Radius; LoadModel(factory, out BatchInformations, out TextureInformations); }
private CaseInsensitiveHashSet GetFavoriteRecipes(Farmer who, bool cooking) { long id = who.UniqueMultiplayerID; CaseInsensitiveHashSet?result; if (cooking) { UserFavorites !.Cooking.TryGetValue(id, out result); } else { UserFavorites !.Crafting.TryGetValue(id, out result); } if (result == null) { result = new(); if (cooking) { UserFavorites !.Cooking.Add(id, result); } else { UserFavorites !.Crafting.Add(id, result); } } return(result); }
public async void CreatePref(Cooking cooking, int index) { img.texture = await LoadImg(cooking.url); alt.text = cooking.alt; number.text = Convert.ToString(index + 1); }
public static string GetRecipe(this Cooking value) { var field = value.GetType().GetField(value.ToString()); var attribute = Attribute.GetCustomAttribute(field, typeof(RecipeAttribute)) as RecipeAttribute; return(attribute.Recipe); }
public static string GetDescription(this Cooking value) { var field = value.GetType().GetField(value.ToString()); var attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute; return(attribute == null?value.ToString() : attribute.Description); }
public ActionResult DeleteConfirmed(int id) { Cooking cooking = db.Cooking.Find(id); db.Cooking.Remove(cooking); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Initialize() { _foundation = new Foundation(); _physics = new Physics(_foundation); Cooking = new Cooking(_foundation, _physics); DebugLog.Log("Initialized", "Mesh Formatter"); }
public static string GetRecipeChannelString(this Cooking value) { var i18n = DataLoader.i18n; return(String.Format("{0}/{1}/{2}", value.GetDescription(), i18n.Get($"Cooking.{value}.TV"), i18n.Get($"Cooking.{value}.Name"))); }
public static Model LoadConvexMesh(Scene scene, Device device) { var torusModel = ColladaLoader.Load(@"Resources\Torus.DAE", device); var core = scene.Core; // Allocate memory for the points and triangles var convexMeshDesc = new ConvexMeshDescription() { PointCount = torusModel.VertexPositions.Length }; convexMeshDesc.Flags |= ConvexFlag.ComputeConvex; convexMeshDesc.AllocatePoints <Vector3>(torusModel.VertexPositions.Length); // Write in the points and triangles // We only want the Position component of the vertex. Also scale down the mesh. foreach (var vertex in torusModel.VertexPositions) { var t = SlimDX.Matrix.Scaling(0.1f, 0.1f, 0.1f); var position = SlimDX.Vector3.TransformCoordinate(vertex, t); convexMeshDesc.PointsStream.Write(position); } // // Cook to memory or to a file ConvexMesh convexMesh; using (var stream = new MemoryStream()) { //FileStream stream = new FileStream( @"Convex Mesh.cooked", FileMode.CreateNew ); Cooking.InitializeCooking(new ConsoleOutputStream()); Cooking.CookConvexMesh(convexMeshDesc, stream); Cooking.CloseCooking(); stream.Position = 0; convexMesh = core.CreateConvexMesh(stream); } var convexShapeDesc = new ConvexShapeDescription(convexMesh); var actorDesc = new ActorDescription() { BodyDescription = new BodyDescription(10.0f), GlobalPose = Matrix.Translation(30, 30, 0) }; actorDesc.Shapes.Add(convexShapeDesc); var actor = scene.CreateActor(actorDesc); return(torusModel); }
public HttpResponseMessage Post(Cooking item) { item = WebApiApplication.CookingRepository.Add(item); var serializer = new JavaScriptSerializer(); var responseJson = serializer.Serialize(item); var response = Request.CreateResponse(HttpStatusCode.Created, responseJson); return(response); }
public static string GetRecipeString(this Cooking value) { var cookingItem = DataLoader.CookingData.getCookingItem(value); var recipeString = $"{cookingItem.Recipe}/1 10/{(int) value} {cookingItem.Amount}/default"; if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.en) { recipeString += "/" + DataLoader.i18n.Get($"Cooking.{value}.Name"); } return(recipeString); }
public Recipe ValidRecipeCheck(Cooking c) { //check if the ingredients on the table create a recipe. Possible optimizations??? foreach (Recipe r in c.gameRecipes.ToList()) { r.score = 0; List <Recipe.Ingredient> copy = r.ingr.ToList(); foreach (Recipe.Ingredient ri in r.ingr.ToList()) { foreach (Ingredient_Full i in storage.ToList()) { if (i.ingr == ri) { if (i.cookValue >= 0) //if its cookable { if (i.cookValue < 1000) { //raw r.score += 500; Debug.Log("Too Raw!"); } else if (i.cookValue > 2000) { //burnt r.score += 400; Debug.Log("Burnt!"); } else if (i.cookValue > 1350 && i.cookValue < 1500) { r.score += 2000; //perfect! Debug.Log("PERFECT!"); } else { r.score += 1000; //almost! Debug.Log("Almost!"); } } copy.Remove(ri); break; } } } if (copy.Count == 0 && storage.Count == r.ingr.Count) { Debug.Log("Recipe Found: " + r.name); r.score += r.baseScore; return(r); } } Debug.Log("No Recipes Found..."); return(null); }
public static string GetObjectString(this Cooking value) { var cookingItem = DataLoader.CookingData.getCookingItem(value); var i18n = DataLoader.i18n; return(String.Format("{0}/{1}/{2}/Cooking -7/{3}/{4}/food/{5} {6} {7} 0 {8} {9} 0 {10} {11} {12} {13} {14}/{15}", value.GetDescription(), cookingItem.Price, cookingItem.Edibility, i18n.Get($"Cooking.{value}.Name"), i18n.Get($"Cooking.{value}.Description"), cookingItem.Farming, cookingItem.Fishing, cookingItem.Mining, cookingItem.Luck, cookingItem.Foraging, cookingItem.MaxEnergy, cookingItem.Magnetism, cookingItem.Speed, cookingItem.Defense, cookingItem.Attack, cookingItem.Duration)); }
public static void resetAllSkills(Player p) { Fletching.setFletchItem(p, null); Herblore.setHerbloreItem(p, null); Cooking.setCookingItem(p, null); Mining.resetMining(p); Smithing.resetSmithing(p); Woodcutting.resetWoodcutting(p); Fishing.resetFishing(p); Crafting.resetCrafting(p); p.removeTemporaryAttribute("harvesting"); }
public CookingItem getCookingItem(Cooking cooking) { switch (cooking) { case Cooking.Meatloaf: return(Meatloaf); case Cooking.OrangeChicken: return(OrangeChicken); case Cooking.MonteCristo: return(MonteCristo); case Cooking.BaconCheeseburger: return(BaconCheeseburger); case Cooking.RoastDuck: return(RoastDuck); case Cooking.RabbitAuVin: return(RabbitAuVin); case Cooking.SteakFajitas: return(SteakFajitas); case Cooking.GlazedHam: return(GlazedHam); case Cooking.SummerSausage: return(SummerSausage); case Cooking.SweetAndSourPork: return(SweetAndSourPork); case Cooking.RabbitStew: return(RabbitStew); case Cooking.WinterDuck: return(WinterDuck); case Cooking.SteakWithMushrooms: return(SteakWithMushrooms); case Cooking.CowboyDinner: return(CowboyDinner); case Cooking.Bacon: return(Bacon); default: throw new ArgumentException("Invalid Cooking"); } }
public void CheckRequirementTest() { Mining mining = new Mining(); Cooking cooking = new Cooking(); Assert.AreEqual(false, skillsController.CheckRequirement(mining.trainingMethods[0])); inventory.AddItem(1267, 1); Assert.AreEqual(true, inventory.Contains(1267)); Assert.AreEqual(true, skillsController.CheckRequirement(mining.trainingMethods[0])); Assert.AreEqual(true, skillsController.CheckRequirement(cooking.trainingMethods[0])); Assert.AreEqual(false, skillsController.CheckRequirement(cooking.trainingMethods[1])); }
public static PhysX.SoftBody TeapotSoftBody(Scene scene) { var doc = new XmlDocument(); doc.Load(@"Resources\Teapot.xml"); // Not how NxuStream are meant to used but what ever :S var vertices = ReadVertices(doc.SelectSingleNode("/NXUSTREAM2/NxuPhysicsCollection/NxSoftBodyMeshDesc/vertices")); var tetrahedraSingles = ReadTetrahedra(doc.SelectSingleNode("/NXUSTREAM2/NxuPhysicsCollection/NxSoftBodyMeshDesc/tetrahedra")); var softBodyMeshDesc = new SoftBodyMeshDescription() { VertexCount = vertices.Length, TetrahedraCount = tetrahedraSingles.Length / 4 // Tetrahedras come in quadruples of ints }; softBodyMeshDesc.AllocateVertices <Vector3>(softBodyMeshDesc.VertexCount); softBodyMeshDesc.AllocateTetrahedra <int>(softBodyMeshDesc.TetrahedraCount); // Note: T is an int. T is the type of each point softBodyMeshDesc.VertexStream.SetData(vertices); softBodyMeshDesc.TetrahedraStream.SetData(tetrahedraSingles); var memoryStream = new MemoryStream(); Cooking.InitializeCooking(); Cooking.CookSoftBodyMesh(softBodyMeshDesc, memoryStream); Cooking.CloseCooking(); memoryStream.Position = 0; var softBodyMesh = scene.Core.CreateSoftBodyMesh(memoryStream); var desc = new SoftBodyDescription() { GlobalPose = Matrix.Translation(-30, 20, -30), SoftBodyMesh = softBodyMesh }; desc.Flags |= SoftBodyFlag.Visualization; desc.MeshData.AllocatePositions <Vector3>(vertices.Length); desc.MeshData.AllocateIndices <int>(tetrahedraSingles.Length); desc.MeshData.NumberOfVertices = vertices.Length; desc.MeshData.NumberOfIndices = tetrahedraSingles.Length; desc.MeshData.MaximumVertices = vertices.Length; desc.MeshData.MaximumIndices = tetrahedraSingles.Length; var softBody = scene.CreateSoftBody(desc); return(softBody); }
public ActionResult Edit([Bind(Include = "Код,id_Strav,id_Tovary,masa,Odun_vumiry,id_Vidila_kyx,Data")] Cooking cooking) { if (ModelState.IsValid) { db.Entry(cooking).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_Strav = new SelectList(db.Dishes, "id_Strav", "Nazva_Strav", cooking.id_Strav); ViewBag.id_Tovary = new SelectList(db.Goods, "id_Goods", "Tovar", cooking.id_Tovary); ViewBag.id_Vidila_kyx = new SelectList(db.Vidil_kyx, "id_Vidila_kyx", "Nazva_vidily", cooking.id_Vidila_kyx); return(View(cooking)); }
// Start is called before the first frame update void Start() { currentFoods = new List <Food>(); cookedFood = new List <Food>(); totalTime = 0f; currentTime = 0f; totalBurningTime = 0f; currentBurningTime = 0f; cook = GetComponent <Cooking>(); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cooking cooking = db.Cooking.Find(id); if (cooking == null) { return(HttpNotFound()); } return(View(cooking)); }
public PhysxPhysicWorld(Vector3 gravity, bool connectToRemoteDebugger = false) { physix = new PhysX.Physics(new ErrorCallbackImp(), true); var sceneDesc = new SceneDesc() { Gravity = gravity.AsPhysX() }; scene = physix.CreateScene(sceneDesc); this.scene.SetVisualizationParameter(VisualizationParameter.Scale, 1.0f); this.scene.SetVisualizationParameter(VisualizationParameter.CollisionShapes, true); this.scene.SetVisualizationParameter(VisualizationParameter.JointLocalFrames, true); this.scene.SetVisualizationParameter(VisualizationParameter.JointLimits, true); this.scene.SetVisualizationParameter(VisualizationParameter.ParticleSystemPosition, true); this.scene.SetVisualizationParameter(VisualizationParameter.ActorAxes, true); // Connect to the remote debugger if it's there if (connectToRemoteDebugger) { physix.ConnectToRemoteDebugger("localhost"); } objs = new List<IPhysicObject>(); ctns = new List<IPhysicConstraint>(); cooking = physix.CreateCooking(); }