public void OnFunctions() { if (MyOnlineNode != null) { if (MyOnlineNode != null) { if (Evading == false) { MyFather.transform.Rotate(RightRotation); MyOnlineNode.PasarRotacionIA(MyFather.transform.rotation); } else { MyFather.transform.Rotate(0f, Invert, 0f); MyOnlineNode.PasarRotacionIA(MyFather.transform.rotation); } } } else if (MyOnlineNode == null) { if (Evading == false) { MyFather.transform.Rotate(RightRotation); } else { MyFather.transform.Rotate(0f, Invert, 0f); } } }
public void OnFunctions() { if (DirectRotation == false) { OnCoolDown(); } if (DirectRotation == true) { if (MyOnlineNode != null) { TriangulationOff(); Quaternion TempQ = Funciones.SacaGrados(Target.transform.position, MyFather.transform.position); MyFather.transform.rotation = Quaternion.Euler(0f, TempQ.eulerAngles.y, 0f); MyOnlineNode.PasarRotacionIA(MyFather.transform.rotation); //fuerza directa if (Funciones.SacaDistancia(Target.transform.position, MyFather.transform.position) > StopLimit) { Rb.AddRelativeForce(0f, 0f, DirectForce); Rb.velocity = Rb.velocity.normalized * DirectNormalized; MyDirectAnimator.SetInteger(MyDirectAnimatorName, DirectAnimation); MyOnlineNode.PasarAnimacionIAint(MyDirectAnimatorName, DirectAnimation); } else { Rb.AddRelativeForce(0f, 0f, 0f); Rb.velocity = Rb.velocity.normalized * DirectNormalized; MyDirectAnimator.SetInteger(MyDirectAnimatorName, 0); MyOnlineNode.PasarAnimacionIAint(MyDirectAnimatorName, 0); } } if (MyOnlineNode == null) { TriangulationOff(); Quaternion TempQ = Funciones.SacaGrados(Target.transform.position, MyFather.transform.position); MyFather.transform.rotation = Quaternion.Euler(0f, TempQ.eulerAngles.y, 0f); //fuerza directa if (Funciones.SacaDistancia(Target.transform.position, MyFather.transform.position) > StopLimit) { Rb.AddRelativeForce(0f, 0f, DirectForce); Rb.velocity = Rb.velocity.normalized * DirectNormalized; MyDirectAnimator.SetInteger(MyDirectAnimatorName, DirectAnimation); } else { Rb.AddRelativeForce(0f, 0f, 0f); Rb.velocity = Rb.velocity.normalized * DirectNormalized; MyDirectAnimator.SetInteger(MyDirectAnimatorName, 0); } } } }