private void UpdateTargetInformation()
        {
            if (!NpcSensorSight.NpcsInSight.Any())
            {
                CurrentEnemyTarget = null;
            }
            else if (CurrentEnemyTarget == null)
            {
                CurrentEnemyTarget = NpcSensorSight.GetClosestNpc();
            }

            if (NpcSensorSight.PickablesInSight.Any() && CurrentMedicalKitTarget == null)
            {
                CurrentMedicalKitTarget = NpcSensorSight.GetClosestPickable(TypePickable.Medicalkit);
            }

            if (NpcSensorSight.PickablesInSight.Any() && CurrentShotgunTarget == null)
            {
                CurrentShotgunTarget = NpcSensorSight.GetClosestPickable(TypePickable.Shotgun);
            }

            if (NpcSensorSight.PickablesInSight.Any() && CurrentUziTarget == null)
            {
                CurrentUziTarget = NpcSensorSight.GetClosestPickable(TypePickable.Uzi);
            }

            UpdateCurrentEnemyDistance();
        }
        protected override State EvaluateAttacking()
        {
            UpdateCampedMedicalKit();

            if (isCamping)
            {
                if (CurrentEnemyTarget == null)
                {
                    return(State.Idle);
                }

                if (Vector3.Distance(NpcSensorSight.GetClosestNpc().transform.root.position, campedMedKit.transform.root.position) - 3
                    <
                    Vector3.Distance(Mover.transform.root.position, campedMedKit.transform.root.position) ||
                    Health.HealthPoints < HealthRetreatTolerance)
                {
                    return(State.Engaging);
                }

                return(State.Attacking);
            }

            if (!NpcSensorSight.NpcsInSight.Any())
            {
                return(State.Idle);
            }

            if (Health.HealthPoints < HealthRetreatTolerance)
            {
                return(State.Retreating);
            }

            return(DistanceToCurrentEnemy < DistanceSwitchFromEngagingToAttacking ? State.Attacking : State.Engaging);
        }
Exemplo n.º 3
0
        protected override void DoRetreating()
        {
            if (!IsOutsideOfZone)
            {
                retreatingMovementRoutine.UpdateMovementRoutine(NpcSensorSight.GetClosestNpc().transform.root.position);
            }

            Mover.RotateTowardsDirection(GetPredictiveAimDirection(CurrentEnemyTarget));

            HandController.Use();
        }
Exemplo n.º 4
0
        protected override void DoAttacking()
        {
            if (CurrentEnemyTarget == null)
            {
                CurrentEnemyTarget = NpcSensorSight.GetClosestNpc();
            }

            Mover.RotateTowardsDirection(GetPredictiveAimDirection(CurrentEnemyTarget));

            HandController.Use();
        }
Exemplo n.º 5
0
        protected override void DoEngaging()
        {
            if (CurrentEnemyTarget == null)
            {
                CurrentEnemyTarget = NpcSensorSight.GetClosestNpc();
            }

            Mover.RotateTowardsDirection(GetPredictiveAimDirection(CurrentEnemyTarget));
            Mover.MoveTowardsPosition(CurrentEnemyTarget.transform.root.position);

            HandController.Use();
        }