Пример #1
0
    // Token: 0x060022F6 RID: 8950 RVA: 0x0040C444 File Offset: 0x0040A644
    public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
    {
        Transform transform = sam.transform;
        Vector3   vector    = sam.SpreadPos - 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, sam.SpreadPos, parent.MoveSpeed * 1.3f * deltaTime);
        if (GameConstants.DistanceSquare(transform.position, sam.SpreadPos) <= 0.0001f)
        {
            sam.SpreadPos  = Vector3.zero;
            sam.SpreadMode = ESpreadMode.NotSpread;
            if (sam.Parent.Target.GroupKind == EGroupKind.CastleGate)
            {
                sam.FSMController = FSMManager.Instance.getState(EStateName.RANGE_FIGHT_WALL);
            }
            else
            {
                sam.FSMController = FSMManager.Instance.getState(EStateName.RANGE_FIGHT);
            }
        }
    }
Пример #2
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);
     }
 }
Пример #3
0
    // Token: 0x06002308 RID: 8968 RVA: 0x0040CDB4 File Offset: 0x0040AFB4
    public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
    {
        if (sam.Flag == 0)
        {
            sam.Timer -= deltaTime;
            if (sam.Timer > 0f)
            {
                return;
            }
            sam.Flag = 1;
            sam.PlayAnim(ESheetMeshAnim.moving, SAWrapMode.Loop, false, false, false);
        }
        Vector3   vector    = Vector3.zero;
        Transform transform = sam.transform;

        if (sam.Flag == 1)
        {
            vector = FSMUnit.WALL_BACK;
        }
        else
        {
            if (sam.Flag != 2)
            {
                sam.Flag = 0;
                if (FSMManager.Instance.bIsBattleOver && DataManager.Instance.War_LordCapture != 0)
                {
                    sam.FSMController = FSMManager.Instance.getState(EStateName.GO_CAPTIVING);
                }
                else
                {
                    sam.FSMController = FSMManager.Instance.getState(EStateName.IDLE_FASTRUN);
                }
                return;
            }
            vector = FSMUnit.WALL_FRONT;
        }
        Vector3 vector2 = vector - transform.position;

        if (vector2 != Vector3.zero)
        {
            Quaternion quaternion = Quaternion.LookRotation(vector2);
            if (transform.rotation != quaternion)
            {
                transform.rotation = Quaternion.Slerp(transform.rotation, quaternion, 5f * deltaTime);
            }
        }
        FSMUnit.MoveSoldier(sam, vector, parent.MoveSpeed * deltaTime * 2.5f);
        if (GameConstants.DistanceSquare(transform.position, vector) <= 0.0001f)
        {
            sam.Flag += 1;
        }
    }
Пример #4
0
 // Token: 0x060022F9 RID: 8953 RVA: 0x0040C830 File Offset: 0x0040AA30
 public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
 {
     if (sam.Index == 255)
     {
         Transform transform = sam.transform;
         Vector3   vector    = sam.SpreadPos - transform.position;
         if (vector != Vector3.zero)
         {
             transform.rotation = Quaternion.LookRotation(vector);
         }
         FSMUnit.MoveSoldier(sam, sam.SpreadPos, sam.DyingValue * deltaTime);
         if (sam.DieState == 1 && (sam.SpreadPos == Vector3.zero || GameConstants.DistanceSquare(transform.position, sam.SpreadPos) <= 0.0001f))
         {
             sam.FSMController = FSMManager.Instance.getState(EStateName.DIE);
         }
     }
     else if (sam.Flag != 0)
     {
         float   fightTimer    = sam.fightTimer;
         float   inverseLength = 1f / fightTimer;
         Vector3 center        = (sam.SpreadPos + sam.LastTargetPos) * 0.5f;
         center.y = sam.DyingValue;
         sam.transform.position = GameConstants.QuadraticBezierCurves(sam.LastTargetPos, center, sam.SpreadPos, inverseLength, sam.Timer);
         sam.Timer += deltaTime;
         if (sam.Timer >= fightTimer)
         {
             sam.transform.position = sam.SpreadPos;
             sam.SpreadPos          = Vector3.zero;
             sam.FSMController      = FSMManager.Instance.getState(EStateName.DIE);
             sam.PlayAnim(ESheetMeshAnim.die, SAWrapMode.Once, true, false, false);
             sam.Flag = 0;
         }
     }
     else
     {
         Transform transform2 = sam.transform;
         Vector3   vector2    = sam.SpreadPos - transform2.position;
         if (vector2 != Vector3.zero)
         {
             transform2.rotation = Quaternion.LookRotation(vector2);
             FSMUnit.MoveSoldier(sam, sam.SpreadPos, sam.DyingValue * deltaTime);
         }
         if (sam.DieState == 1 && (sam.SpreadPos == Vector3.zero || GameConstants.DistanceSquare(transform2.position, sam.SpreadPos) <= 0.0001f))
         {
             sam.FSMController = FSMManager.Instance.getState(EStateName.DIE);
         }
     }
 }
Пример #5
0
    // Token: 0x0600231A RID: 8986 RVA: 0x0040D5FC File Offset: 0x0040B7FC
    public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
    {
        Transform transform = sam.transform;
        Vector3   vector    = sam.SpreadPos - transform.position;

        if (vector != Vector3.zero)
        {
            Quaternion quaternion = Quaternion.LookRotation(vector);
            if (quaternion != transform.rotation)
            {
                transform.rotation = Quaternion.Slerp(transform.rotation, quaternion, 5f * deltaTime);
            }
        }
        float num = (parent != null) ? parent.MoveSpeed : 4.5f;

        FSMUnit.MoveSoldier(sam, sam.SpreadPos, num * 2.5f * deltaTime * 1.5f);
    }
Пример #6
0
 // Token: 0x0600231D RID: 8989 RVA: 0x0040D734 File Offset: 0x0040B934
 public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
 {
     if (sam.Flag == 1)
     {
         return;
     }
     if (sam.Flag == 2)
     {
         Transform transform = sam.transform;
         Vector3   vector    = Camera.main.transform.position - transform.position;
         vector.y = 0f;
         if (vector != Vector3.zero)
         {
             Quaternion quaternion = Quaternion.LookRotation(vector);
             if (quaternion != transform.rotation)
             {
                 transform.rotation = Quaternion.Slerp(transform.rotation, quaternion, 5f * deltaTime);
             }
             else
             {
                 sam.Flag = 1;
             }
         }
     }
     else
     {
         Transform transform2 = sam.transform;
         Vector3   vector2    = sam.SpreadPos - transform2.position;
         if (vector2 != Vector3.zero)
         {
             Quaternion quaternion2 = Quaternion.LookRotation(vector2);
             if (quaternion2 != transform2.rotation)
             {
                 transform2.rotation = Quaternion.Slerp(transform2.rotation, quaternion2, 5f * deltaTime);
             }
         }
         float num = (parent != null) ? parent.MoveSpeed : 4.5f;
         FSMUnit.MoveSoldier(sam, sam.SpreadPos, num * 2.5f * deltaTime * 1.5f);
         if (GameConstants.DistanceSquare(transform2.position, sam.SpreadPos) <= 0.0001f)
         {
             sam.Flag = 2;
             sam.PlayAnim(ESheetMeshAnim.victory, SAWrapMode.Loop, true, false, false);
         }
     }
 }
Пример #7
0
    // Token: 0x060022E4 RID: 8932 RVA: 0x0040BDD4 File Offset: 0x00409FD4
    public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
    {
        if (sam.Target == null || sam.Target.FSMController == null || sam.Target.CurFSM == EStateName.DIE || sam.Target.CurFSM == EStateName.DYING)
        {
            sam.FSMController = FSMManager.Instance.getState(EStateName.LOSETARGET);
        }
        Transform transform  = sam.Target.transform;
        Transform transform2 = sam.transform;

        FSMUnit.CheckDirectionToTarget(sam, deltaTime);
        FSMUnit.MoveSoldier(sam, transform.position, parent.MoveSpeed * 1.3f * deltaTime);
        float num = sam.AttackRadius + sam.Target.Radius;

        if (GameConstants.DistanceSquare(transform2.position, transform.position) < num * num)
        {
            sam.FSMController = FSMManager.Instance.getState(EStateName.MELEE_FIGHT);
        }
    }
Пример #8
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;
            }
        }
    }
Пример #9
0
 // Token: 0x06002311 RID: 8977 RVA: 0x0040D2A4 File Offset: 0x0040B4A4
 public override void Update(Soldier sam, ArmyGroup parent, float deltaTime)
 {
     if (sam.CaptiveFlag == 0)
     {
         return;
     }
     if (sam.CaptiveFlag == 1)
     {
         Transform transform = sam.transform;
         Vector3   vector    = sam.CaptivePos - transform.position;
         if (vector != Vector3.zero)
         {
             Quaternion to = Quaternion.LookRotation(vector);
             transform.rotation = Quaternion.Slerp(transform.rotation, to, 5f * deltaTime);
         }
         FSMUnit.MoveSoldier(sam, sam.CaptivePos, parent.MoveSpeed * 2.5f * deltaTime);
         if (GameConstants.DistanceSquare(transform.position, sam.CaptivePos) <= 0.0001f)
         {
             sam.CaptiveFlag = 2;
             sam.PlayAnim(ESheetMeshAnim.victory, SAWrapMode.Loop, true, false, false);
             FSMManager.Instance.CaptivingCount++;
             sam.CaptivePos = sam.Parent.SoldierTarget.transform.position - transform.position;
         }
     }
     else if (sam.CaptiveFlag == 2)
     {
         Transform transform2 = sam.transform;
         if (sam.CaptivePos != Vector3.zero)
         {
             Quaternion quaternion = Quaternion.LookRotation(sam.CaptivePos);
             if (quaternion != transform2.rotation)
             {
                 transform2.rotation = Quaternion.Slerp(transform2.rotation, quaternion, 5f * deltaTime);
             }
             else
             {
                 sam.CaptiveFlag = 0;
             }
         }
     }
 }