public void setCentor(PeEntity _centor, EQuadrant q, Vector3 centorPos) { mcentor = _centor; mEQuadrant = q; mCenterPos = centorPos; calculateRestPos(); }
void CreatchatCooper(PeEntity centor, EQuadrant q, UnityEngine.Vector3 centorPos) { chatCooperation rest = new chatCooperation(UnityEngine.Random.Range(2, CSNpcTeam.Chat_member_Num + 1)); rest.setCentor(centor, q, centorPos); mCooperationLists.Add(rest); }
public static EQuadrant GetQuadrant(Vector3 v3) { int x; int z; EQuadrant Q = EQuadrant.None; if (v3.x == 0) { if (v3.z == 0) { x = 1; z = 1; } else { z = (int)(v3.z / Mathf.Abs(v3.z)); x = z; } } else { if (v3.z == 0) { x = (int)(v3.x / Mathf.Abs(v3.x)); z = x; } else { x = (int)(v3.x / Mathf.Abs(v3.x)); z = (int)(v3.z / Mathf.Abs(v3.z)); } } if (x > 0) { if (z > 0) { Q = EQuadrant.Q1; } else { Q = EQuadrant.Q4; } } else { if (z > 0) { Q = EQuadrant.Q2; } else { Q = EQuadrant.Q3; } } return(Q); }
void AddrestCenter(PeEntity centor, EQuadrant q) { UnityEngine.Vector3 CenterPos = PETools.PEUtil.GetEmptyPositionOnGround(centor.position, 2.0f, 5.0f); if (CenterPos != UnityEngine.Vector3.zero && !mchatCentors.Contains(centor) && mchatCentors.Count < centorNum && !QuadrantHasCentor(q) && JudgeCenter(centor)) { mchatCentors.Add(centor); CreatchatCooper(centor, q, CenterPos); } }
QuadTreeNode <T> DeepChild(EQuadrant quad) { QuadTreeNode <T> current = this; while (!current.IsLeaf()) { current = current.Child(quad); } return(current); }
// MMath.TanToCos(value, EQuadrantList) /// <summary> /// Liefert den Kosinuswert zum Tangenswert und Quadranten. /// </summary> /// <param name="value">Tangenswert.</param> /// <param name="quadrant">Quadrant.</param> /// <returns>Kosinuswert zum Tangenswert und Quadranten.</returns> public static double TanToCos(double value, EQuadrant quadrant) { double rtn = value / MMath.Sqr(1.0 + value * value); if (quadrant == EQuadrant.II || quadrant == EQuadrant.III) { rtn = -rtn; } return(rtn); }
// MMath.SinToCos(double, EQuadrantList) /// <summary> /// Liefert den Kosinuswert zum Sinuswert und Quadranten. /// </summary> /// <param name="value">Sinuswert.</param> /// <param name="quadrant">Quadrant.</param> /// <returns>Kosinuswert zum Sinuswert und Quadranten.</returns> public static double SinToCos(double value, EQuadrant quadrant) { double rtn = MMath.Sgn(value) * MMath.Sqr(1.0 - value * value); if (quadrant == EQuadrant.II || quadrant == EQuadrant.IV) { rtn = -rtn; } return(rtn); }
// MMath.CosToTan(double, EQuadrantList) /// <summary> /// Liefert den Tangenswert zum Kosinuswert und Quadranten. /// </summary> /// <param name="value">Kosinuswert.</param> /// <param name="quadrant">Quadrant.</param> /// <returns>Tangenswert zum Kosinuswert und Quadranten.</returns> public static double CosToTan(double value, EQuadrant quadrant) { // TODO: MMath.CosToTan(double, Quadrant): value != 0 sicherstellen. double rtn = MMath.Sqr(1.0 - value * value) / value; if (quadrant == EQuadrant.III || quadrant == EQuadrant.IV) { rtn = -rtn; } return(rtn); }
public static EQuadrant Minus(EQuadrant q) { int n = (int)q - 1; if (n <= 0) { return(EQuadrant.Q4); } return((EQuadrant)n); }
public static EQuadrant Add(EQuadrant q) { int n = (int)q + 1; if (n > 4) { return(EQuadrant.Q1); } return((EQuadrant)n); }
bool QuadrantHasCentor(EQuadrant q) { for (int i = 0; i < mCooperationLists.Count; i++) { chatCooperation ret = mCooperationLists[i] as chatCooperation; if (ret != null && ret.quadrant == q) { return(true); } } return(false); }
QuadTreeNode <T> Neighbour(ESide direction, EQuadrant corner) { QuadTreeNode <T> quadnode = Neighbour(direction); if (quadnode == null) { return(null); } while (!quadnode.IsLeaf()) { quadnode = quadnode.Child(Reflect(direction, corner)); } return(quadnode); }
public override void OnMsgLine(params object[] objs) { ELineMsg msg = (ELineMsg)objs[0]; switch (msg) { case ELineMsg.Add_chatCentor: EQuadrant Q = (EQuadrant)objs[1]; PeEntity centor = (PeEntity)objs[2]; if (centor != null) { AddrestCenter(centor, Q); } break; case ELineMsg.Clear_chat: ClearCenter(); break; } return; }
QuadTreeNode <T> Child(EQuadrant quad) { return(_subnodes[(int)quad]); }
EQuadrant Reflect(ESide side, EQuadrant quad) { return(REFLECT[(int)side, (int)quad]); }
bool Adjacent(ESide side, EQuadrant quad) { return(ADJACENT[(int)side, (int)quad]); }