// Token: 0x0600018F RID: 399 RVA: 0x0000E194 File Offset: 0x0000C394
 private void AgentSetTarget()
 {
     if (this.targetIsPlayer)
     {
         this.agentController.target = PlayerSettings.instance.simulatedRagdoll.bodyElements.ragdollJoints[0].transform;
     }
     if (!this.abideByFlags)
     {
         return;
     }
     if (Flag.flagsInScene.Count == 0)
     {
         return;
     }
     this.closestFlag = Flag.GetClosestFlag(this.agent.transform.position, Flag.Type.Follow);
     if (this.closestFlag == null)
     {
         return;
     }
     SmartRagdollController.Logic logic = this.logic;
     if (logic == SmartRagdollController.Logic.Follow && this.closestFlag.type == Flag.Type.Follow)
     {
         this.agentController.target = this.closestFlag.transform;
     }
 }
示例#2
0
    // Token: 0x0600017C RID: 380 RVA: 0x0000DE00 File Offset: 0x0000C000
    public static SmartRagdollController ClosestRagdoll(Vector3 fromPosition, SmartRagdollController.Logic ofLogic)
    {
        if (RagdollDatabase.activeRagdollsInScene.Count == 0)
        {
            return(null);
        }
        SmartRagdollController result = null;
        float num = float.PositiveInfinity;

        for (int i = 0; i < RagdollDatabase.activeRagdollsInScene.Count; i++)
        {
            if (!(RagdollDatabase.activeRagdollsInScene[i] == null) && RagdollDatabase.activeRagdollsInScene[i].isActiveAndEnabled && RagdollDatabase.activeRagdollsInScene[i].logic == ofLogic)
            {
                float num2 = Vector3.Distance(fromPosition, RagdollDatabase.activeRagdollsInScene[i].simulatedRagdollCore.position);
                if (num2 < num)
                {
                    num    = num2;
                    result = RagdollDatabase.activeRagdollsInScene[i];
                }
            }
        }
        return(result);
    }
 // Token: 0x0600018E RID: 398 RVA: 0x0000E098 File Offset: 0x0000C298
 private void RagdollAttackDefendTargeting(SmartRagdollController.Logic chaseLogic)
 {
     if (this.ragdollFound == null)
     {
         this.ragdollFound = RagdollDatabase.ClosestRagdoll(this.simulatedRagdollCore.position, chaseLogic);
     }
     if (this.ragdollFound != null)
     {
         if (this.ragdollFound.simulatedRagdoll.ragdollModeEnabled)
         {
             this.ragdollFound = RagdollDatabase.ClosestRagdoll(this.simulatedRagdollCore.position, chaseLogic);
         }
         if (this.ragdollFound == null)
         {
             return;
         }
         this.agentController.moveMethod = AgentController.MoveMethod.MoveToPosition;
         this.agentController.target     = this.ragdollFound.simulatedRagdollCore;
         if (Vector3.Distance(this.simulatedRagdollCore.position, this.ragdollFound.simulatedRagdollCore.position) < this.attackDistance)
         {
             this.ragdollFound.simulatedRagdoll.RagdollModeEnabled = true;
             return;
         }
     }
     else
     {
         if (chaseLogic == SmartRagdollController.Logic.Attack)
         {
             this.agentController.moveMethod = AgentController.MoveMethod.FollowTarget;
         }
         else
         {
             this.agentController.moveMethod = AgentController.MoveMethod.MoveToPosition;
         }
         this.AgentSetTarget();
     }
 }
    // Token: 0x06000190 RID: 400 RVA: 0x0000E240 File Offset: 0x0000C440
    public static bool RagdollHasLogic(Transform ragdollTransform, SmartRagdollController.Logic logicToCheck)
    {
        SmartRagdollController componentInChildren = ragdollTransform.root.GetComponentInChildren <SmartRagdollController>();

        return(!(componentInChildren == null) && componentInChildren.logic == logicToCheck);
    }