Esempio n. 1
0
 // Token: 0x060022D2 RID: 8914 RVA: 0x0040B49C File Offset: 0x0040969C
 public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
 {
     if (sam.ActionMode == EActionMode.Personal)
     {
         Transform transform      = sam.transform;
         Vector3   transformPoint = parent.getTransformPoint((int)sam.Index);
         Vector3   vector         = transformPoint - transform.position;
         if (vector != Vector3.zero)
         {
             Quaternion to = Quaternion.LookRotation(vector);
             transform.rotation = Quaternion.Slerp(transform.rotation, to, 5f * deltaTime);
         }
         FSMUnit.MoveSoldier(sam, transformPoint, parent.MoveSpeed * 1.3f * deltaTime);
         if (GameConstants.DistanceSquare(transform.position, transformPoint) <= 0.0001f)
         {
             sam.ActionMode = EActionMode.Team;
             sam.PlayAnim(ESheetMeshAnim.idle, SAWrapMode.Loop, true, false, false);
             sam.NotifyingParent(0);
         }
     }
     else if (sam.transform.rotation != parent.groupRoot.rotation)
     {
         sam.transform.rotation = Quaternion.Slerp(sam.transform.rotation, parent.groupRoot.rotation, 5f * deltaTime);
     }
 }
Esempio n. 2
0
    // Token: 0x060022DB RID: 8923 RVA: 0x0040B780 File Offset: 0x00409980
    public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
    {
        if (sam.Flag != 0)
        {
            sam.Timer -= deltaTime;
            if (sam.Timer > 0f)
            {
                return;
            }
            sam.Flag = 0;
            sam.PlayAnim(ESheetMeshAnim.moving, SAWrapMode.Loop, false, false, false);
        }
        Vector3   transformPoint = parent.getTransformPoint((int)sam.Index);
        Transform transform      = sam.transform;

        if (sam.ActionMode == EActionMode.Team)
        {
            transform.position = transformPoint;
            if (transform.rotation != parent.m_Direction)
            {
                transform.rotation = Quaternion.Slerp(transform.rotation, parent.m_Direction, 5f * deltaTime);
            }
        }
        else
        {
            Vector3 vector = transformPoint - transform.position;
            if (vector != Vector3.zero)
            {
                Quaternion quaternion = Quaternion.LookRotation(vector);
                if (transform.rotation != quaternion)
                {
                    transform.rotation = Quaternion.Slerp(transform.rotation, quaternion, 5f * deltaTime);
                }
            }
            FSMUnit.MoveSoldier(sam, transformPoint, parent.MoveSpeed * deltaTime);
            if (GameConstants.DistanceSquare(transform.position, transformPoint) <= 0.0001f)
            {
                sam.ActionMode = EActionMode.Team;
            }
        }
    }