예제 #1
0
    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);
                }
            }
        }
    }
예제 #2
0
 public void OnFunctions(string MiDato)
 {
     if (MyOnlineNode != null)
     {
         if (MyAnimator != null)
         {
             if (MiDato == "int")
             {
                 MyAnimator.SetInteger(MyNameIntSet, MyIntSet);
                 MyOnlineNode.PasarAnimacionIAint(MyNameIntSet, MyIntSet);
             }
             if (MiDato == "bool")
             {
                 MyAnimator.SetBool(MyNameBoolSet, MyBoolSet);
                 MyOnlineNode.PasarAnimacionIAbool(MyNameBoolSet, MyBoolSet);
             }
             if (MiDato == "float")
             {
                 MyAnimator.SetFloat(MyNameFloatSet, MiSetFloat);
                 MyOnlineNode.PasarAnimacionIAfloat(MyNameFloatSet, MiSetFloat);
             }
         }
     }
     else
     {
         if (MyAnimator != null)
         {
             if (MiDato == "int")
             {
                 MyAnimator.SetInteger(MyNameIntSet, MyIntSet);
             }
             if (MiDato == "bool")
             {
                 MyAnimator.SetBool(MyNameBoolSet, MyBoolSet);
             }
             if (MiDato == "float")
             {
                 MyAnimator.SetFloat(MyNameFloatSet, MiSetFloat);
             }
         }
     }
 }