コード例 #1
0
            // Token: 0x06001D8C RID: 7564 RVA: 0x00089F6C File Offset: 0x0008816C
            public void SetHull(HullClassification hullClassification)
            {
                HullDef hullDef = HullDef.Find(hullClassification);

                this.testCharacterController.radius = hullDef.radius;
                this.testCharacterController.height = hullDef.height;
            }
コード例 #2
0
        // Token: 0x06001D84 RID: 7556 RVA: 0x00089AB8 File Offset: 0x00087CB8
        private void BuildRailLinks(ReadOnlyCollection <MapNode> nodes, MapNode.MoveProbe moveProbe)
        {
            Vector3 position = base.transform.position;

            for (int i = 0; i < nodes.Count; i++)
            {
                MapNode mapNode = nodes[i];
                if (!(mapNode == this))
                {
                    Vector3 position2    = mapNode.transform.position;
                    float   num          = MapNode.maxConnectionDistance * 2f;
                    float   num2         = num * num;
                    float   sqrMagnitude = (position2 - position).sqrMagnitude;
                    if (sqrMagnitude < num2)
                    {
                        float distanceScore = Mathf.Sqrt(sqrMagnitude);
                        for (int j = 0; j < 3; j++)
                        {
                            HullDef hullDef = HullDef.Find((HullClassification)j);
                            if ((this.forbiddenHulls & (HullMask)(1 << j)) == HullMask.None && (mapNode.forbiddenHulls & (HullMask)(1 << j)) == HullMask.None)
                            {
                                moveProbe.SetHull((HullClassification)j);
                                Vector3 vector  = position;
                                Vector3 vector2 = position2;
                                if (Vector3.Angle(Vector3.up, vector2 - vector) > 50f)
                                {
                                    vector.y  += hullDef.height;
                                    vector2.y += hullDef.height;
                                    if (moveProbe.CapsuleOverlapTest(vector) && moveProbe.CapsuleOverlapTest(vector2) && moveProbe.FlyTest(vector, vector2, 6f))
                                    {
                                        this.AddLink(mapNode, distanceScore, 0f, (HullClassification)j);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        // Token: 0x06000974 RID: 2420 RVA: 0x0002F30C File Offset: 0x0002D50C
        public override void FixedUpdate()
        {
            base.FixedUpdate();
            if (base.ai && base.body)
            {
                Vector3 footPosition = base.body.footPosition;
                base.ai.pathFollower.UpdatePosition(footPosition);
                this.updateTimer     -= Time.fixedDeltaTime;
                this.pathUpdateTimer -= Time.fixedDeltaTime;
                this.strafeTimer     -= Time.fixedDeltaTime;
                if (this.updateTimer <= 0f)
                {
                    this.updateTimer = UnityEngine.Random.Range(0.16666667f, 0.2f);
                    AISkillDriver.MovementType movementType = AISkillDriver.MovementType.Stop;
                    SkillSlot skillSlot = SkillSlot.None;
                    bool      flag      = false;
                    BaseAI.SkillDriverEvaluation skillDriverEvaluation = base.ai.skillDriverEvaluation;
                    this.dominantSkillDriver = skillDriverEvaluation.dominantSkillDriver;
                    BaseAI.Target target = skillDriverEvaluation.target;
                    if (this.dominantSkillDriver)
                    {
                        movementType = this.dominantSkillDriver.movementType;
                        skillSlot    = this.dominantSkillDriver.skillSlot;
                        flag         = this.dominantSkillDriver.activationRequiresTargetLoS;
                    }
                    Vector3 position = base.body.transform.position;
                    Vector3 b        = base.bodyInputBank ? base.bodyInputBank.aimOrigin : position;
                    Vector3 vector   = position;
                    Vector3 vector2  = vector;
                    this.moveTargetPositionFound = (target != null && target.GetBullseyePosition(out vector));
                    if (this.moveTargetPositionFound)
                    {
                        CharacterBody characterBody = target.characterBody;
                        if (characterBody)
                        {
                            vector2 = characterBody.footPosition;
                        }
                        else
                        {
                            vector2 = vector;
                        }
                        if (this.pathUpdateTimer <= 0f)
                        {
                            base.ai.RefreshPath(footPosition, vector2);
                            this.pathUpdateTimer = this.pathUpdateInterval;
                        }
                    }
                    Vector3 normalized = (vector - b).normalized;
                    bool    flag2      = true;
                    if (this.dominantSkillDriver && this.dominantSkillDriver.activationRequiresAimConfirmation)
                    {
                        flag2 = false;
                        if (base.bodyInputBank && Vector3.Dot(base.bodyInputBank.aimDirection.normalized, normalized) >= 0.95f)
                        {
                            flag2 = true;
                        }
                    }
                    Vector3 normalized2 = (((this.dominantSkillDriver && this.dominantSkillDriver.ignoreNodeGraph) ? ((base.ai.nodegraphType == MapNodeGroup.GraphType.Ground) ? vector2 : vector) : base.ai.pathFollower.GetNextPosition()) - footPosition).normalized;
                    Vector3 vector3     = Vector3.Cross(Vector3.up, normalized2);
                    Vector3 vector4     = position;
                    if (movementType == AISkillDriver.MovementType.ChaseMoveTarget)
                    {
                        vector4 += normalized2;
                    }
                    else if (movementType == AISkillDriver.MovementType.FleeMoveTarget)
                    {
                        vector4 -= normalized2;
                    }
                    else if (movementType == AISkillDriver.MovementType.StrafeMovetarget)
                    {
                        if (this.strafeTimer <= 0f)
                        {
                            this.strafeDirection = 0f;
                        }
                        if (this.strafeDirection == 0f)
                        {
                            LayerMask  mask    = LayerIndex.world.mask | LayerIndex.defaultLayer.mask;
                            float      num     = 0.25f * base.body.moveSpeed;
                            float      num2    = num;
                            float      num3    = num;
                            HullDef    hullDef = HullDef.Find(base.body.hullClassification);
                            float      radius  = hullDef.radius;
                            float      height  = hullDef.height;
                            Vector3    b2      = Vector3.up * (height * 0.5f - radius);
                            RaycastHit raycastHit;
                            if (Physics.CapsuleCast(position + b2, position - b2, radius, vector3, out raycastHit, num, mask))
                            {
                                num2 = raycastHit.distance;
                            }
                            if (Physics.CapsuleCast(position + b2, position - b2, radius, -vector3, out raycastHit, num, mask))
                            {
                                num3 = raycastHit.distance;
                            }
                            if (num3 == num2)
                            {
                                this.strafeDirection = ((UnityEngine.Random.Range(0, 1) == 0) ? -1f : 1f);
                            }
                            else
                            {
                                this.strafeDirection = ((num3 < num2) ? 1f : -1f);
                            }
                            if (this.strafeDirection != 0f)
                            {
                                this.strafeTimer = 0.25f;
                            }
                        }
                        vector4 += vector3 * this.strafeDirection;
                    }
                    base.ai.localNavigator.targetPosition = vector4;
                    base.ai.localNavigator.Update(Time.fixedDeltaTime);
                    bool newState  = false;
                    bool newState2 = false;
                    bool newState3 = false;
                    bool newState4 = false;
                    if (((target != null) ? target.gameObject : null) && flag2 && (!flag || base.ai.HasLOS(position, vector)))
                    {
                        switch (skillSlot)
                        {
                        case SkillSlot.Primary:
                            newState = true;
                            break;

                        case SkillSlot.Secondary:
                            newState2 = true;
                            break;

                        case SkillSlot.Utility:
                            newState3 = true;
                            break;

                        case SkillSlot.Special:
                            newState4 = true;
                            break;
                        }
                    }
                    Vector3 vector5 = base.ai.localNavigator.moveVector;
                    if (base.bodyCharacterMotor && movementType == AISkillDriver.MovementType.ChaseMoveTarget && Vector3.Dot(vector5, base.bodyCharacterMotor.velocity.normalized) <= 0.5f)
                    {
                        vector5 *= 0.5f;
                    }
                    if (this.dominantSkillDriver)
                    {
                        vector5 *= this.dominantSkillDriver.moveInputScale;
                    }
                    if (base.bodyInputBank)
                    {
                        base.bodyInputBank.skill1.PushState(newState);
                        base.bodyInputBank.skill2.PushState(newState2);
                        base.bodyInputBank.skill3.PushState(newState3);
                        base.bodyInputBank.skill4.PushState(newState4);
                        bool newState5 = false;
                        if (base.bodyCharacterMotor && base.bodyCharacterMotor.isGrounded && Mathf.Max(base.ai.pathFollower.CalculateJumpVelocityNeededToReachNextWaypoint(base.body.moveSpeed), base.ai.localNavigator.jumpSpeed) > 0f)
                        {
                            newState5 = true;
                        }
                        base.bodyInputBank.jump.PushState(newState5);
                        base.bodyInputBank.moveVector = vector5;
                    }
                    if (!this.dominantSkillDriver)
                    {
                        this.outer.SetNextState(new LookBusy());
                        return;
                    }
                }
                this.activeSoundTimer -= Time.fixedDeltaTime;
                if (this.activeSoundTimer <= 0f)
                {
                    this.activeSoundTimer = UnityEngine.Random.Range(3f, 8f);
                    base.body.CallRpcBark();
                }
            }
        }