private void DetectSelectedItem() { bool NearCoralForSelect = false; bool NearOreForSelect = false; bool NearFishForSelect = false; TypeCommon Coral = Common.ListCorals.Find(coral => NearCoralForSelect = Ray.IntersectsWithObject(objectAABB: coral.Mesh.BoundingBox, distance: 500)); TypeCommon Ore = Common.ListOres.Find(ore => NearOreForSelect = Ray.IntersectsWithObject(objectAABB: ore.Mesh.BoundingBox, distance: 500)); if (Character.CanFish && Coral.Mesh is null && Ore.Mesh is null) { Fish itemFish = Fishes.Find(fish => NearFishForSelect = Ray.IntersectsWithObject(objectAABB: fish.BoundingBox, distance: 500)); if (NearFishForSelect) { SelectItem(itemFish); } } NearObjectForSelect = NearCoralForSelect || NearOreForSelect || NearFishForSelect; if (NearCoralForSelect) { SelectItem(Coral); } else if (NearOreForSelect) { SelectItem(Ore); } }
public Fish(Skybox skybox, Terrain terrain, TypeCommon mesh) { director = new TGCVector3(0, 0, 1); Skybox = skybox; Terrain = terrain; Mesh = mesh; Init(); }
public void GenerateDuplicates(TgcMesh common, ref List <TypeCommon> commons, int quantity, bool createRB = true) { foreach (int index in Enumerable.Range(0, quantity)) { TypeCommon newCommon = new TypeCommon { Quantity = index, Name = common.Name + "_" + index }; newCommon.Mesh = common.createMeshInstance(newCommon.Name); newCommon.Mesh.Transform = TGCMatrix.Scaling(Constants.Scale); if (createRB) { CreateRigidBody(ref newCommon); } commons.Add(newCommon); } }
private void SelectItem(TypeCommon item) { if (item.Mesh != null && Input.keyPressed(Key.E)) { SoundManager.Collect.play(); ShowInfoItemCollect = true; ItemSelected = item.Name; PhysicalWorld.RemoveBodyToTheWorld(item.Body); QuadTree.RemoveMesh(item.Mesh); if (item.Name.Contains("CORAL")) { Common.ListCorals.Remove(item); } else { Common.ListOres.Remove(item); } } }
private void CreateRigidBody(ref TypeCommon common) { common.Body = RigidBodyFactory.CreateRigidBodyFromTgcMesh(common.Mesh); common.Body.CenterOfMassTransform = TGCMatrix.Translation(common.Mesh.Position).ToBulletMatrix(); common.Body.CollisionShape.LocalScaling = Constants.Scale.ToBulletVector3(); }
public void GetTypeTest() { var type = TypeCommon.GetType <string>(); }