float CurrentBreathAlpha(ref ChakraType ref_cur) { this.Breath.CurrentBreathsPerRep = this.CommonChakras.Count / 2; if (CommonChakras.Count < 1) { foreach (var c in this.Body.Chakras.AllChakras) { if (IsCommonChakra(c)) { this.CommonChakras.Add(c); } } this.CommonChakras.Sort((a, b) => (a.transform.position.y > b.transform.position.y) ? 1 : -1); int n = this.CommonChakras.Count; for (int i = n - 1; i >= 0; i--) { this.CommonChakras.Add(this.CommonChakras [i]); } } //then if (CommonChakras.Count > 0) { var curLevel = this.CommonChakras [this.Breath.BreathIndex % this.CommonChakras.Count]; if (this.IsGuideAvatar) { ref_cur = curLevel; } return(this.Breath.UnitBreathInPct); } // else return(1.0f); }
public int ChakraIndex(ChakraPosition p) { var all = this.ChakraExcersize.Body.Chakras.AllChakras; for (int i = 0; i < all.Length; i++) { if (all [i] == p) { return(i); } } Debug.LogError("Couldn't find this one: " + p.name); return(-1); }
public void ExportChakraMesh(ChakraPosition cp, Mesh m) { ObjExporterScript ex = new ObjExporterScript(); ObjExporterScript.Start(); string str = ObjExporterScript.MeshToString(m, this.transform, null); int index = this.ChakraIndex(cp); string toPath = (Application.dataPath + "/ExportedMeshes/ChakraMesh_" + (index + 1) + "_" + cp.name.Trim().Replace(" ", "_") + ".obj"); Debug.Log("Saving mesh to: " + toPath); StreamWriter sw = new StreamWriter(toPath); sw.Write(str); sw.Close(); }
ChakraType FindClosestChakra() { var ray = FocusRay.main.CurrentRay; var bestDot = -100.0f; ChakraType bestChakra = null; //this.CurrentChakra; foreach (var c in this.Body.Chakras.AllChakras) // .AllPoints) { { if (IsCommonChakra(c)) { var d = Vector3.Dot(ray.direction, (c.transform.position - ray.origin).normalized); float minAngle = 0.95f; // 0.98f; if ((d > bestDot) && (d > minAngle)) { bestChakra = c; bestDot = d; } } } return(bestChakra); }
private bool IsCommonChakra(ChakraType c) { return(true); //return ((!c.IsAura) && (!c.IsMultiChakras) && (!c.IsLEWFlowField)); }