Exemplo n.º 1
0
 private void UpdateSpatial()
 {
     if (null != m_Entity && null != Actor)
     {
         MovementStateInfo msi = m_Entity.GetMovementStateInfo();
         if (Math.Abs(msi.GetWantedFaceDir() - msi.GetFaceDir()) > Geometry.c_FloatPrecision)
         {
             float      degree  = Geometry.RadianToDegree(msi.GetWantedFaceDir());
             Quaternion targetQ = Quaternion.Euler(0, degree, 0);
             Actor.transform.localRotation = Quaternion.RotateTowards(Actor.transform.localRotation,
                                                                      targetQ, c_TurnRoundSpeed * Time.deltaTime);
             float dir = Geometry.DegreeToRadian(Actor.transform.localEulerAngles.y);
             msi.SetFaceDir(dir, false);
         }
         else
         {
             SyncFaceDir();
         }
     }
     SyncPosition();
 }
 static public int GetWantedFaceDir(IntPtr l)
 {
     try {
         GameFramework.MovementStateInfo self = (GameFramework.MovementStateInfo)checkSelf(l);
         var ret = self.GetWantedFaceDir();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }