protected void CheckDists(LPCorporeal poly) { LPFixture[] polys = poly.gameObject.GetComponents <LPFixturePoly>(); LPFixture[] chains = poly.gameObject.GetComponents <LPFixtureChainShape>(); LPFixture[] fixes = new LPFixture[0]; if (polys != null && chains == null) { fixes = polys; } else if (polys == null && chains != null) { fixes = chains; } else if (polys != null && chains != null) { fixes = new LPFixture[polys.Length + chains.Length]; Array.Copy(polys, fixes, polys.Length); Array.Copy(chains, 0, fixes, polys.Length, chains.Length); } if (fixes.Length > 1) { fixes = fixes.OrderBy(d => d.ClosestDist).ToArray(); fixes[0].EditMe = true; for (int i = 1; i < fixes.Length; i++) { fixes[i].EditMe = false; } } }
protected void CheckDists(LPCorporeal poly) { LPFixture[] polys = poly.gameObject.GetComponents<LPFixturePoly>(); LPFixture[] chains = poly.gameObject.GetComponents<LPFixtureChainShape>(); LPFixture[] fixes = new LPFixture[0]; if (polys!=null && chains == null) { fixes = polys; } else if(polys==null && chains != null) { fixes = chains; } else if (polys!=null && chains !=null) { fixes = new LPFixture[polys.Length + chains.Length]; Array.Copy(polys, fixes,polys.Length); Array.Copy(chains,0,fixes,polys.Length,chains.Length); } if (fixes.Length > 1) { fixes = fixes.OrderBy(d => d.ClosestDist).ToArray(); fixes[0].EditMe = true; for (int i = 1; i < fixes.Length; i++) { fixes[i].EditMe = false; } } }
static void CopyGeneric(Collider2D unity, LPFixture lp2d) { #if UNITY_5_0 lp2d.Offset = unity.offset; #endif lp2d.PhysMaterial = unity.sharedMaterial; lp2d.IsSensor = unity.isTrigger; }
/// <summary>Add a fixture to this bodies list of fixtures ///Note: this is normally called from the fixtures Initialise method</summary> public int AddFixture(LPFixture fixture) { myFixtures.Add(fixturesIndex,fixture); fixturesIndex++; return fixturesIndex -1; }
/// <summary>Add a fixture to this bodies list of fixtures ///Note: this is normally called from the fixtures Initialise method</summary> public int AddFixture(LPFixture fixture) { myFixtures.Add(fixturesIndex, fixture); fixturesIndex++; return(fixturesIndex - 1); }
static void CopyGeneric(Collider2D unity, LPFixture lp2d) { #if UNITY_5_0 lp2d.Offset = unity.offset; #endif lp2d.PhysMaterial = unity.sharedMaterial; lp2d.IsSensor = unity.isTrigger; }