public void clearBrush() { if (brush != null) { brush.removeFromScene (); brush = null; } }
public IEnumerator BuildStructureTree(ArticleSerializable[] articles) { leaves = new List <Leaf> (); for (int i = 0; i < articles.Length; i++) { GetCategories(articles[i]); yield return(new WaitForSeconds(1f)); for (int j = 0; j < APIRestClient.categories.Length; j++) { GetThematic(APIRestClient.categories[j]); yield return(new WaitForSeconds(1f)); TreePlus tree = new TreePlus("arbol"); Trunk trunk = new Trunk(APIRestClient.thematics [0].id, APIRestClient.thematics [0].nombre, APIRestClient.thematics[0].descripcion, tree); Branch branch = new Branch(APIRestClient.categories [j].id, APIRestClient.categories [j].nombre, APIRestClient.categories[j].descripcion, trunk); Leaf leaf = FindExistingArticle(leaves, articles [i].id); if (leaf == null) { leaf = new Leaf(articles [i].id, articles [i].titulo, articles [i].contenido, branch); leaves.Add(leaf); } else { leaf.branchs.Add(branch); } } } SetStatus(StatusBuildTree.Completed); }
private void UpdateHolding() { if (IsAttacking || IsThrowing) { _animator.speed = _animatorSpeed; _rigidbody2D.velocity = Vector2.zero; } else { bool isOnTrunk = false; RaycastHit2D[] raycastHit2DTrunk = Physics2D.RaycastAll(Head.position, Vector2.up, 1f); foreach (RaycastHit2D hit in raycastHit2DTrunk) { Trunk trunk = hit.collider.GetComponent <Trunk>(); if (trunk != null) { isOnTrunk = true; break; } } if (!isOnTrunk) { OnTrunkExit(); } else { float horizontalInput = Input.GetAxisRaw("Horizontal"); _animator.speed = _animatorSpeed * Mathf.Abs(horizontalInput); _rigidbody2D.velocity = Vector2.right * ClimbSpeed * horizontalInput; } } }
public void Generate(int2 cellIndex) { parentCell = worley.GetCellProfile(cellIndex); vertices = new NativeList <float3>(Allocator.Temp); triangles = new NativeList <int>(Allocator.Temp); random = new Unity.Mathematics.Random((uint)(parentCell.data.value * 1000)); leaves = new Leaves(vertices, triangles); trunk = new Trunk(vertices, triangles, random); baseHeight = simplex.GetSimplex(parentCell.data.position.x, parentCell.data.position.z) * 15; DrawChildCells(worley.frequency * 2); //leaves.Draw(parentCellProfile, 0); trunk.DrawTrunk(parentCell); DrawCellSegments(parentCell); DrawCellLines(parentCell); MakeMesh(); vertices.Dispose(); triangles.Dispose(); }
public Branch(int new_id, string new_name, string new_description, Trunk new_trunk) { id = new_id; name = new_name; description = new_description; trunk = new Trunk(new_trunk.id, new_trunk.name, new_trunk.description, new_trunk.tree); }
/// <summary> /// Basic branch flow, reused to check true and false flows /// </summary> /// <returns> /// The <see cref="Trunk"/>. /// </returns> private static Trunk GetBranchTest() { var root = new Trunk(CreateScript("Z = X + Y")); root.AddBranch(CreateBranchScript("return X > Y;"), new Trunk(CreateScript("Y = 150")), new Trunk(CreateScript("Z = 99"))); return(root); }
/// <summary> /// Get the tree /// </summary> /// <returns> /// The <see> /// <cref>ITree</cref> /// </see> /// . /// </returns> private static ITree <GoalSeekContext> GetTree() { var root = new Trunk(ScriptHelper.GetScript <GoalSeekContext>("Tax = (decimal)(TargetDecimal * (decimal)0.3)")); root.AddSection(ScriptHelper.GetScript <GoalSeekContext>("Tax = (decimal)(Tax + 1000)")) .AddSection(ScriptHelper.GetScript <GoalSeekContext>("TargetDecimal = TargetDecimal - Tax + DecimalToManipulate")); return(new Tree <GoalSeekContext>(root, new Producer <GoalSeekContext>())); }
public void UnloadProduct() { if (Trunk.Count < 1) { throw new InvalidOperationException("No products left in vehicle!"); } Trunk.RemoveAt(Trunk.Count - 1); }
public void LoadProduct(Product product) { if (Trunk.Count > Capacity) { throw new InvalidOperationException("Vehicle is full!"); } Trunk.Add(product); }
public void clearBrush() { if (brush != null) { brush.removeFromScene(); brush = null; } }
/// <summary> /// Draws the trunk using the specified world, view, and projection matrices. /// </summary> /// <param name="world">World matrix.</param> /// <param name="view">View matrix.</param> /// <param name="projection">Projection matrix.</param> /// <exception cref="InvalidOperationException">If no trunk effect is set.</exception> /// <exception cref="InvalidOperationException">If no Skeleton is set.</exception> /// <remarks> /// This method sets all the appropriate effect parameters. /// </remarks> public new void DrawTrunk(Matrix world, Matrix view, Matrix projection) { if (Skeleton == null) { throw new InvalidOperationException("A Skeleton must be set before trunk can be rendered."); } if (TrunkEffect == null) { throw new InvalidOperationException("TrunkEffect must be set before trunk can be rendered."); } #region New code Effect effect = TrunkEffect; effect.Parameters["World"].SetValue(world); effect.Parameters["WorldIT"].SetValue(Matrix.Transpose(Matrix.Invert(world))); effect.Parameters["WorldViewProj"].SetValue(world * view * projection); effect.Parameters["ViewInv"].SetValue(Matrix.Invert(view)); effect.Parameters["Texture"].SetValue(TrunkTexture); effect.Parameters["isSkydome"].SetValue(false); effect.Parameters["LightDirection"].SetValue(Lighting.LightDirection); effect.Parameters["LightColor"].SetValue(Lighting.LightColor); effect.Parameters["LightColorAmbient"].SetValue(Lighting.LightColorAmbient); effect.Parameters["FogColor"].SetValue(Lighting.FogColor); effect.Parameters["fDensity"].SetValue(Lighting.FogDensity); effect.Parameters["SunLightness"].SetValue(Lighting.SunLightness); effect.Parameters["sunRadiusAttenuation"].SetValue(Lighting.SunRadiusAttenuation); effect.Parameters["largeSunLightness"].SetValue(Lighting.LargeSunLightness); effect.Parameters["largeSunRadiusAttenuation"].SetValue(Lighting.LargeSunRadiusAttenuation); effect.Parameters["dayToSunsetSharpness"].SetValue(Lighting.DayToSunsetSharpness); effect.Parameters["hazeTopAltitude"].SetValue(Lighting.HazeTopAltitude); #endregion #region Original code // TrunkEffect.Parameters["World"].SetValue(world); // TrunkEffect.Parameters["View"].SetValue(view); // TrunkEffect.Parameters["Projection"].SetValue(projection); // Skeleton.CopyBoneBindingMatricesTo(BindingMatrices, AnimationState.BoneRotations); TrunkEffect.Parameters["Bones"].SetValue(BindingMatrices); // // TrunkEffect.Parameters["Texture"].SetValue(trunkTexture); #endregion Trunk.Draw(effect); }
public async Task RootTest() { // Given ISection root = new Trunk(ScriptHelper.GetScript <TreeTestContext>("Z = X + Y")); ITree <TreeTestContext> tree = new Tree <TreeTestContext>(root, Producer); var context = new TreeTestContext(1, 3); // When await tree.Run(context); // Then Assert.AreEqual(4, context.Z); }
private GameObject ShowTrunk(Trunk new_trunk, Vector3 coordinates, GameObject tree) { GameObject trunk = (GameObject)Instantiate(PrefabTrunk, coordinates, PrefabTrunk.transform.rotation); trunk.name = trunk.name + "-id" + new_trunk.id; trunk.transform.SetParent(tree.transform); TrunkEvents trunkEvents = trunk.GetComponent <TrunkEvents> (); trunkEvents.trunk = new_trunk; trunkEvents.trunk_name = new_trunk.name; return(trunk); }
public void TestInCSharp() { var eventA = new NameChanged { EntityName = "1234", Name = "Bob", OccurredOn = DateTime.UtcNow }; var eventB = new NameChanged { EntityName = "1234", Name = "Jimmy", OccurredOn = DateTime.UtcNow.AddDays(1) }; var markovA = MarkovEvent.Build("NameChanged", eventA, eventA.OccurredOn); var markovB = MarkovEvent.Build("NameChanged", eventB, eventB.OccurredOn); var trunk = new Trunk(); var braidDiscriminators = new BraidLinkDiscriminators(); braidDiscriminators.AddDiscriminator(x => BraidLinkDiscriminationResult.ISaidYes); var chainLongitudinalEvaluators = LongitudinalEvaluators.Build(); chainLongitudinalEvaluators.AddEvaluator(LongitudinalEvaluator.Build("Identity", () => JsonConvert.SerializeObject(0), (a, s) => { var state = JsonConvert.DeserializeObject <int>(s); Console.WriteLine(state); state++; s = JsonConvert.SerializeObject(state); var result = new EvaluationResult(); result.Value.X = JsonConvert.SerializeObject(a); result.Value.Y = JsonConvert.SerializeObject(a.OccurredOn); result.State = s; return(result); }, (a, b, e, s) => JsonConvert.SerializeObject(a.OccurredOn - b.OccurredOn))); var chainBuilder = ChainBuilder.Build(x => ChainIdentity.Build(x.Payload["EntityName"].ToString()), chainLongitudinalEvaluators); var braidBuilder = BraidBuilder.Build("Initial", braidDiscriminators, chainBuilder, LongitudinalEvaluators.Build()); trunk.AddBraid(braidBuilder); trunk.Accept(markovA); trunk.Accept(markovB); }
private TrunkEvents FindExistingTrunk(Trunk trunk) { TrunkEvents[] trunkEvents = GameObject.FindObjectsOfType <TrunkEvents>(); foreach (TrunkEvents trunkEvent in trunkEvents) { // print ("ID: " + trunkEvent.trunk.id + "ID param trunk: " + trunk.id); if (trunkEvent.trunk.id == trunk.id) { return(trunkEvent); } } return(null); }
public void createNewBrush() { //clear current brush clearBrush (); //create new colour configuration for each form ColourConfiguration.BackgroundType background = ColourConfiguration.BackgroundType.None; if (colourConfig != null) { background = colourConfig.getBackgroundType(); } colourConfig = new ColourConfiguration(); colourConfig.setBackgroundType (background); //create new brush brush = new Trunk(currentConfig, colourConfig); largestBoundsDistance = brush.getLargestBoundDistance (); }
public void createNewBrush() { //clear current brush clearBrush(); //create new colour configuration for each form ColourConfiguration.BackgroundType background = ColourConfiguration.BackgroundType.None; if (colourConfig != null) { background = colourConfig.getBackgroundType(); } colourConfig = new ColourConfiguration(); colourConfig.setBackgroundType(background); //create new brush brush = new Trunk(currentConfig, colourConfig); largestBoundsDistance = brush.getLargestBoundDistance(); }
public LocalTrunkProxieTest() { trunk = new Trunk("Display Name", "trunk.domain", "user", Transports.Udp, new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234), "server.url", "username", "password", "*****@*****.**", 0) { //Nonce = new ByteArrayPart("NONCEVALUE"), //Opaque = new ByteArrayPart("OPAQUEVALUE"), AuthHeader = HeaderNames.Authorization, }; trunk.UpdateChallenge(new ByteArrayPart("NONCEVALUE"), new ByteArrayPart("OPAQUEVALUE"), new ByteArrayPart("auth")); proxie = new LocalTrunkProxie(0x12345678, trunk); destAddr = new ConnectionAddresses(Transports.Udp, new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234), new IPEndPoint(IPAddress.Parse("9.0.0.0"), 9000), 99); srcAddr = new ConnectionAddresses(Transports.Tcp, new IPEndPoint(IPAddress.Parse("5.6.7.8"), 5678), new IPEndPoint(IPAddress.Parse("8.0.0.0"), 8000), 88); request = CreateForwardedRequest( "INVITE sip:[email protected] SIP/2.0\r\n" + "Via: SIP/2.0/TCP 127.0.0.1:11371\r\n" + "Max-Forwards: 70\r\n" + "From: <sip:[email protected]>;tag=123;epid=456\r\n" + "To: <sip:[email protected]>\r\n" + "Call-ID: 403d20dd4ff84d178cd187b5710cb9a8\r\n" + "CSeq: 25 INVITE\r\n" + "Contact: <sip:[email protected]:11371;maddr=127.0.0.1;transport=tcp>;proxy=replace;+sip.instance=\"<urn:uuid:6984F470-4B9A-5F59-90C1-C9CA88CF214A>\"\r\n" + "Authorization: Digest username=\"jdoe2\", realm=\"officesip.local\", qop=auth, algorithm=MD5, uri=\"sip:[email protected]\", nonce=\"c01ba269fbd8eb84d29a52bd8ba7ba7e\", nc=6, cnonce=\"85550150622448769693330628644602\", opaque=\"00000001\", response=\"feed390d2fcaa5e65f0ce57eaa64756c\"\r\n" + "Content-Type: application/sdp\r\n" + "Content-Length: 135\r\n" + "\r\n", content); response = CreateForwardedResponse( "SIP/2.0 200 OK\r\n" + "Via: SIP/2.0/UDP 1.2.3.4:1234;branch=z9hG4bK12345678\r\n" + "Record-Route: <sip:1.2.3.4:1234;lr>\r\n" + "Via: SIP/2.0/TCP 127.0.0.1:11371\r\n" + "Max-Forwards: 69\r\n" + "From: \"Display Name\" <sip:[email protected]>;tag=123;epid=456\r\n" + "To: <sip:[email protected]>;tag=321\r\n" + "Call-ID: callid\r\n" + "CSeq: 1 INVITE\r\n" + "Contact: <sip:55.55.55.55:5555;transport=udp>;+sip.instance=\"<urn:uuid:123>\"\r\n" + "Content-Type: application/sdp\r\n" + "WWW-Authenticate: Digest realm=\"xxx\",nonce=\"0d0f70e6aa82aac734235c10f150271f\",qop=\"auth\",algorithm=MD5,stale=false,opaque=\"00000001\"\r\n" + "Content-Length: 135\r\n", content); }
public async Task MultipleSequentialSegmentsTest() { // Given var root = new Trunk(CreateScript("Z = X + Y")); root.AddSection(CreateScript("Z = Z * 10")).AddSection(CreateScript("Y = Y * Y")).AddSection(CreateScript("X = -123")); ITree <TreeTestContext> tree = new Tree <TreeTestContext>(root, Producer); var context = new TreeTestContext(1, 3); // When await tree.Run(context); // Then Assert.AreEqual(-123, context.X); Assert.AreEqual(9, context.Y); Assert.AreEqual(40, context.Z); }
public void DestroyTree(bool forceDestroy = false) { if (listTrunk.Count == 0 && forceDestroy == false) { GameController.instance.AddScore(baseScore); GameController.instance.CountTree(); } while (listTrunk.Count > 0) { Trunk trunk = listTrunk[0]; listTrunk.RemoveAt(0); trunk.RemoveFromTree(true); } Destroy(gameObject); }
public void TestInJavaScript() { var eventAOccurredOn = DateTime.UtcNow; var eventBOccurredOn = DateTime.UtcNow.AddDays(1); var eventA = "{ \"EntityName\" : \"1234\", \"Name\" : \"Bob\", \"OccurredOn\" : \"" + eventAOccurredOn + "\"}"; var eventB = "{ \"EntityName\" : \"1234\", \"Name\" : \"Jimmy\", \"OccurredOn\" : \"" + eventBOccurredOn + "\"}"; var markovA = MarkovEvent.BuildFromJson("NameChanged", eventA, eventAOccurredOn); var markovB = MarkovEvent.BuildFromJson("NameChanged", eventB, eventBOccurredOn); var trunk = new Trunk(); var braidDiscriminators = new BraidLinkDiscriminators(); braidDiscriminators.AddDiscriminator(x => BraidLinkDiscriminationResult.ISaidYes); var chainLongitudinalEvaluators = LongitudinalEvaluators.Build(); string jsInitialize = "function Initialize() {return 0;}"; string jsEvaluator = " function Evaluate(n, e, s) {" + " " + " s += 1;" + " var result = {};" + " result.Value = {};" + " result.Value.X = JSON.stringify(e);" + " result.Value.Y = e.OccurredOn;" + " result.State = s;" + " return result;" + " }"; string jsDistance = " function Distance(eventA, eventB, evaluator, state) { return eventA.OccurredOn - eventB.OccurredOn; } "; chainLongitudinalEvaluators.AddEvaluator(LongitudinalEvaluator.Build("Identity", jsInitialize, jsEvaluator, jsDistance)); var chainBuilder = ChainBuilder.Build(x => ChainIdentity.Build(x.Payload["EntityName"].ToString()), chainLongitudinalEvaluators); var braidBuilder = BraidBuilder.Build("Initial", braidDiscriminators, chainBuilder, LongitudinalEvaluators.Build()); trunk.AddBraid(braidBuilder); trunk.Accept(markovA); trunk.Accept(markovB); }
public Trunk(Trunk parent, GUINode element) { this.element = element; this.parent = parent; nameLabel = new RenameLabelDrawer(); nameLabel.value = element.name; nameLabel.onEndEdit += (str) => { element.name = str.Trim(); }; children = new List <Trunk>(); if (element.Children.Count > 0) { for (int i = 0; i < element.Children.Count; i++) { children.Add(new Trunk(this, element.Children[i] as GUINode)); } } }
public Mushroom(Vector3 crownOffset) { gameObject.name = "tree"; float x = Random.Range(-3.0f, 3.0f); float y = Random.Range(5.0f, 20.0f); float z = Random.Range(-3.0f, 3.0f); Vector3 crownPos = new Vector3(x, y, z) + crownOffset * Random.Range(0.0f, 1.0f); Crown tc = new Crown(8, 4, crownPos); tc.transform.SetParent(transform); float d = Random.Range(0.5f, 1.0f); Trunk tt = new Trunk(crownPos, d); tt.transform.SetParent(transform); }
public async Task <IActionResult> AddTrunk([FromBody] Trunk trunk) { try { await _context.Trunks.AddAsync(trunk); await _context.SaveChangesAsync(); var Uri = Url.Link("GetTrunk", new { trunkId = trunk.Id }); return(Created(Uri, trunk)); } catch (ArgumentException ex) { } catch (Exception ex) { } return(BadRequest()); }
public void object_graph_report() { var robotBus = new Trunk( new Shoulder(new LeftArm()), new Hip(new RightThigh(new RightLowerLimb(new RightFoot())))); robotBus.AcceptLogVisitor(_target); var reportItems = new[] { "Trunk is: On", " Shoulder is: On", " Left arm is: Off", " Hip is: On", " Right thigh is: On", " Right lower limb is: On", " Right foot is: On", "" }; Assert.AreEqual(string.Join("\n", reportItems), _target.GetStatusReport()); Assert.AreEqual(1.08, _target.GetRechargeCosts()); }
public Product Unload() { if (this.ISEMPTY == true) { throw new InvalidOperationException("No products left in vehicle!"); } else { foreach (var item in products) { Console.WriteLine("Capacity" + products.Capacity); } Console.WriteLine("The last Element is Removed"); int index = products.Count() - 1; Product p = products.ElementAt(index); products.RemoveAt(index); foreach (var item in products) { Trunk.Append(item); } return(p); } }
public void Init() { instance = new Trunk(); }
public void Generate() { if (trunkMesh) { DestroyImmediate(trunkMesh); } trunkMesh = new Mesh { name = "trunkMesh" }; if (branchMesh) { DestroyImmediate(branchMesh); } branchMesh = new Mesh { name = "branchMesh" }; if (leafStemMesh) { DestroyImmediate(leafStemMesh); } leafStemMesh = new Mesh { name = "leafStemMesh" }; if (leafMesh) { DestroyImmediate(leafMesh); } leafMesh = new Mesh { name = "leafMesh" }; Tree tree = new Tree(); tree.childParentRatio = childrenParentRatio; tree.widthLengthRatio = trunkWidthLengthRatio; tree.recursionDepth = recursionDepth; tree.leafStemPoint = leafStemPoint; tree.leafStemAngle = leafStemAngle; tree.leafStemNodesPerSegment = leafStemNodesPerSegment; tree.leafStemsPerNode = leafStemsPerNode; tree.leavesPerNode = leavesPerNode; tree.leafYRotation = leafYRotation; tree.leafStemYRotation = leafStemYRotation; tree.leafStemCurve = leafStemCurve; tree.leafStemCurveVariation = leafStemCurveVariation; tree.leafStemCurveBack = leafStemCurveBack; tree.leafStemCurveBackVariation = leafStemCurveBackVariation; tree.leafStemLength = leafStemLength; tree.leafStemRadius = leafStemRadius; tree.leafStemSplitFactor = leafStemSplitFactor; tree.leafStemSplitAngle = leafStemSplitAngle; tree.leafStemSplitAngleVariation = leafStemSplitAngleVariation; tree.leafStemSegCount = leafStemSegCount; tree.leafNodePerSegment = leafNodePerSegment; tree.leafAngle = leafAngle; tree.leafRotationXAngle = leafRotationXAngle; tree.leafWidth = leafWidth; tree.leafLength = leafLength; Trunk trunk = new Trunk(); trunk.flare = flare; trunk.basePoint = new Vector3(0, 0, 0); trunk.baseRotation = Quaternion.Euler(0, 0, 0); trunk.branchNumber = branchNumber; trunk.branchingRotationY = branchingRotationY; trunk.branchingAngle = branchingAngle; trunk.branchingAngleVariation = branchingAngleVariation; trunk.branchingFactor = trunkBranchingProbability; trunk.branchBranchingFactor = branchingProbabilityForBranch; trunk.branchingPoint = trunkBranchingPoint; trunk.branchingPointForBranch = branchBranchingPoint; trunk.curveBackAngle = curveBackAngle; trunk.curveBackAngleVariation = curveBackAngleVariation; trunk.branchSplitFactor = branchSplitProbability; trunk.branchSplitAngle = branchSplitAngle; trunk.branchSplitAngleVariation = branchSplitAngleVariation; trunk.branchTaper = branchTaper; trunk.branchWidthLengthRatio = branchWidthLengthRatio; trunk.curveAngle = trunkCurveAngle; trunk.curveAngleVariation = trunkCurveAngleVariation; trunk.segCount = segCount; trunk.numberOfSectors = numberOfSectors; trunk.splitFactor = trunkSplitProbability; trunk.splitAngle = trunkSplitAngle; trunk.baseSplitPoint = trunkSplitPoint; trunk.splitAngleVariation = trunkSplitAngleVariation; trunk.radius = radius; trunk.widthLengthRatio = trunkWidthLengthRatio; trunk.length = radius * trunkWidthLengthRatio; trunk.taper = trunkTaper; trunk.curveAngleForBranch = branchCurveAngle; trunk.curveAngleVariationForBranch = branchCurveAngleVariation; trunk.branchBeginningRotation = beginningRotation; trunk.levelOfRecursion = 0; trunk.tree = tree; tree.trunk = trunk; tree.random = new System.Random(); tree.GenerateTreeUsingEditorParams(); trunkMesh.SetVertices(tree.trunkVertices); trunkMesh.SetIndices(tree.trunkIndices.ToArray(), MeshTopology.Triangles, 0); trunkMesh.SetUVs(0, tree.trunkUvs); trunkMesh.UploadMeshData(markNoLogerReadable: false); trunkMesh.Optimize(); trunkMesh.RecalculateNormals(); trunkMeshFilter.sharedMesh = trunkMesh; trunkMeshRenderer.sharedMaterial = treeMaterial; branchMesh.SetVertices(tree.branchVertices); branchMesh.SetIndices(tree.branchIndices.ToArray(), MeshTopology.Triangles, 0); branchMesh.SetUVs(0, tree.branchUvs); branchMesh.UploadMeshData(markNoLogerReadable: false); branchMesh.Optimize(); branchMesh.RecalculateNormals(); branchMeshFilter.sharedMesh = branchMesh; branchMeshRenderer.sharedMaterial = treeMaterial; leafStemMesh.SetVertices(tree.leafStemVertices); leafStemMesh.SetIndices(tree.leafStemIndices.ToArray(), MeshTopology.Triangles, 0); leafStemMesh.SetUVs(0, tree.leafStemUvs); leafStemMesh.UploadMeshData(markNoLogerReadable: false); leafStemMesh.Optimize(); leafStemMesh.RecalculateNormals(); leafStemMeshFilter.sharedMesh = leafStemMesh; leafStemMeshRenderer.sharedMaterial = treeMaterial; leafMesh.SetVertices(tree.leafVertices); leafMesh.SetIndices(tree.leafIndices.ToArray(), MeshTopology.Triangles, 0); leafMesh.SetUVs(0, tree.leafUvs); leafMesh.UploadMeshData(markNoLogerReadable: false); leafMesh.Optimize(); leafMesh.RecalculateNormals(); leafMeshFilter.sharedMesh = leafMesh; leafMeshRenderer.sharedMaterial = leafMaterial; }
public void PersistsTrees() { Trip trip = Trip.Create(); trip.MeasurerContactInfo = "measurer contact info"; trip.Name = "name"; trip.PhotosAvailable = true; trip.Website = "website"; trip.Date = DateTime.Now; trip.Measurers.Add(Name.Create("tree measurer 1 first name", "tree measurer 1 last name")); trip.Measurers.Add(Name.Create("tree measurer 2 first name", "tree measurer 2 last name")); Site site1 = trip.AddSite(); site1.Name = "site 1 name"; site1.Comments = "site 1 comments"; site1.County = "site 1 county"; site1.OwnershipContactInfo = "site 1 ownership contact info"; site1.OwnershipType = "site 1 ownership type"; site1.State = Repositories.Locations.FindStateByCountryAndStateCode("US", "OH"); Site site2 = trip.AddSite(); site2.Name = "site 2 name"; site2.Comments = "site 2 comments"; site2.Name = "site 2 name"; site2.OwnershipContactInfo = "site 2 ownership contact info"; site2.OwnershipType = "site 2 ownership type"; site2.State = Repositories.Locations.FindStateByCountryAndStateCode("US", "OH"); TreeBase tree1 = site2.AddSingleTrunkTree(); tree1.Age = 10; tree1.AgeClass = TreeAgeClass.VeryOld; tree1.AgeType = TreeAgeType.RingCount; tree1.CrownSpread = Distance.Create(10); tree1.BaseCrownHeight = Distance.Create(20); tree1.ClinometerBrand = "tree measurement 1 clinometer brand"; tree1.CommonName = "tree measurement 1 common name"; tree1.Coordinates = Coordinates.Create(10, 20); tree1.CrownComments = "tree measurement 1 crown comments"; tree1.CrownSpreadMeasurementMethod = "tree measurement 1 crown spread measurement method"; tree1.CrownVolume = Volume.Create(10); tree1.CrownVolumeCalculationMethod = "tree measurement 1 crown volume calculation method"; tree1.Elevation = Elevation.Create(10); tree1.FormType = TreeFormType.Vine; tree1.GeneralComments = "tree measurement 1 general comments"; tree1.Girth = Distance.Create(30); tree1.GirthComments = "tree measurement 1 girth comments"; tree1.GirthMeasurementHeight = Distance.Create(40); tree1.GirthRootCollarHeight = Distance.Create(50); tree1.HealthStatus = "tree measurement 1 health status"; tree1.Height = Distance.Create(60); tree1.HeightComments = "tree measurement 1 height comments"; tree1.HeightMeasurements = HeightMeasurements.Create( Distance.Create(70), Angle.Create(10), Distance.Create(80), Angle.Create(20), DirectedDistance.Create(10)); tree1.HeightMeasurementType = "tree measurement 1 height measurement type"; tree1.LandformIndex = .10f; tree1.LaserBrand = "tree measurement 1 laser brand"; tree1.CrownSpread = Distance.Create(90); tree1.MaximumLimbLength = Distance.Create(100); tree1.NumberOfTrunks = 10; tree1.ScientificName = "tree measurement 1 scientific name"; tree1.Status = TreeStatus.ExoticPlanted; tree1.TerrainComments = "tree measurement 1 terrain comments"; tree1.TerrainShapeIndex = .10f; tree1.TerrainType = TreeTerrainType.HillTop; tree1.TreeFormComments = "tree measurement 1 tree form comments"; tree1.TrunkComments = "tree measurement 1 trunk comments"; tree1.TrunkVolume = Volume.Create(20); tree1.TrunkVolumeCalculationMethod = "tree measurement 1 trunk volume calculation method"; MultiTrunkTree tree2 = site2.AddMultiTrunkTree(); tree2.NumberOfTrunks = 10; tree2.FormType = TreeFormType.Multi; Trunk trunk1 = tree2.AddTrunkMeasurement(); trunk1.Girth = Distance.Create(10); trunk1.GirthMeasurementHeight = Distance.Create(20); trunk1.Height = Distance.Create(30); trunk1.HeightMeasurements = HeightMeasurements.Create( Distance.Create(40), Angle.Create(50), Distance.Create(60), Angle.Create(70), DirectedDistance.Create(80)); Trunk trunk2 = tree2.AddTrunkMeasurement(); trunk2.Girth = Distance.Create(10); trunk2.GirthMeasurementHeight = Distance.Create(20); trunk2.Height = Distance.Create(30); trunk2.HeightMeasurements = HeightMeasurements.Create( Distance.Create(40), Angle.Create(50), Distance.Create(60), Angle.Create(70), DirectedDistance.Create(80)); tree2.Age = 10; tree2.AgeClass = TreeAgeClass.VeryOld; tree2.AgeType = TreeAgeType.RingCount; tree2.CrownSpread = Distance.Create(10); tree2.BaseCrownHeight = Distance.Create(20); tree2.ClinometerBrand = "tree measurement 2 clinometer brand"; tree2.CommonName = "tree measurement 2 common name"; tree2.Coordinates = Coordinates.Create(30, 40); tree2.CrownComments = "tree measurement 2 crown comments"; tree2.CrownSpreadMeasurementMethod = "tree measurement 2 crown spread measurement method"; tree2.CrownVolume = Volume.Create(10); tree2.CrownVolumeCalculationMethod = "tree measurement 2 crown volume calculation method"; tree2.Elevation = Elevation.Create(10); tree2.GeneralComments = "tree measurement 2 general comments"; tree2.Girth = Distance.Create(30); tree2.GirthComments = "tree measurement 2 girth comments"; tree2.GirthMeasurementHeight = Distance.Create(40); tree2.GirthRootCollarHeight = Distance.Create(50); tree2.HealthStatus = "tree measurement 2 health status"; tree2.Height = Distance.Create(60); tree2.HeightComments = "tree measurement 2 height comments"; tree2.HeightMeasurements = HeightMeasurements.Create( Distance.Create(70), Angle.Create(10), Distance.Create(80), Angle.Create(20), DirectedDistance.Create(10)); tree2.HeightMeasurementType = "tree measurement 2 height measurement type"; tree2.LandformIndex = .10f; tree2.LaserBrand = "tree measurement 2 laser brand"; tree2.CrownSpread = Distance.Create(90); tree2.MaximumLimbLength = Distance.Create(100); tree2.ScientificName = "tree measurement 2 scientific name"; tree2.Status = TreeStatus.ExoticPlanted; tree2.TerrainComments = "tree measurement 2 terrain comments"; tree2.TerrainShapeIndex = .10f; tree2.TerrainType = TreeTerrainType.HillTop; tree2.TreeFormComments = "tree measurement 2 tree form comments"; tree2.TrunkComments = "tree measurement 2 trunk comments"; tree2.TrunkVolume = Volume.Create(20); tree2.TrunkVolumeCalculationMethod = "tree measurement 1 trunk volume calculation method"; using (var uow = UnitOfWork.Begin()) { Repositories.Imports.Save(trip); uow.Persist(); } UnitOfWork.Dispose(); using (var uow = UnitOfWork.Begin()) { Trip found = Repositories.Imports.FindById(trip.Id); Assert.IsNotNull(found); Assert.IsTrue(found.Sites.Count == 2); Assert.IsTrue(found.Sites[1].Trees.Count == 2); Repositories.Imports.Remove(found); uow.Persist(); } }
public static TrunkMenu TrunkMenu(Trunk trunk) => new TrunkMenu(trunk);
public void has_an_onoff_status() { var target = new Trunk(); Assert.IsTrue(target.IsOn); }
public IEnumerator ShowForest() { Trunk temporalTrunk = null; Branch temporalBranch = null; GameObject currentTree = null, currentTrunk = null, currentBranch = null; TrunkEvents existingTrunk = null; Vector3 trunkCoordinates = Vector3.zero, branchCoordinates = Vector3.zero, branchAngles = Vector3.zero; foreach (Leaf leaf in leaves) { foreach (Branch branch in leaf.branchs) { // print (leaf.name + " # " + branch.name + " > " + branch.trunk.name); if (temporalTrunk == null || temporalTrunk.id != branch.trunk.id) { if (currentTrunk != null) { existingTrunk = FindExistingTrunk(branch.trunk); } if (existingTrunk == null) { trunkCoordinates = GenerateTrunkCoordinates(); currentTree = ShowTree(trunkCoordinates); currentTrunk = ShowTrunk(branch.trunk, trunkCoordinates, currentTree); temporalTrunk = branch.trunk; } else { trunkCoordinates = existingTrunk.transform.position; currentTrunk = existingTrunk.gameObject; temporalTrunk = branch.trunk; } } if (temporalBranch == null || temporalBranch.id != branch.id) { BranchEvents existingBranch = FindExistingBranch(currentTrunk, branch); if (existingBranch == null) { branchCoordinates = GenerateBranchCoordinates(trunkCoordinates); branchAngles = GenerateBranchRotation(); currentBranch = ShowBranch(branch, branchCoordinates, branchAngles, currentTrunk); temporalBranch = branch; } else { branchCoordinates = existingBranch.transform.position; branchAngles = existingBranch.transform.eulerAngles; currentBranch = existingBranch.gameObject; temporalBranch = branch; } } ShowLeaf(leaf, GenerateLeafCoordinates(branchCoordinates), branchAngles, currentBranch); } JoinByLiana(leaf); } SetStatus(StatusBuildTree.Idle); RemoveSpinner(); yield return(new WaitForSeconds(1f)); }
public Trunk GetTrunk(int x, int y) { int index = GetTrunkIndex(x, y); if (trunks[index] != null) return trunks[index]; Trunk t = new Trunk(x, y); trunks[index] = t; return t; }