public void TickItems(float delta) { if (desiredSpeed == SpeedType.Sprint || currentTarget == null) { targetAimedDuration = 0f; CancelBurst(0f); return; } if (currentTargetLOS) { if (Vector3.Dot(eyes.BodyForward(), currentTarget.CenterPoint() - eyes.position) > 0.85f) { targetAimedDuration += delta; } } else { targetAimedDuration = 0f; } if (targetAimedDuration > 0.5f) { AttackEntity attackEntity = GetAttackEntity(); if ((bool)attackEntity && DistanceToTarget() < attackEntity.effectiveRange * (attackEntity.aiOnlyInRange ? 1f : 2f)) { ShotTest(); } } else { CancelBurst(); } }
protected override bool CanHurt(BaseCombatEntity ent) { if (requireCentreBelowPosition && ent.CenterPoint().y > base.transform.position.y) { return(false); } return(base.CanHurt(ent)); }
public Vector3 AimOffset(BaseCombatEntity aimat) { BasePlayer basePlayer = aimat as BasePlayer; if (!Object.op_Inequality((Object)basePlayer, (Object)null)) { return(aimat.CenterPoint()); } if (basePlayer.IsSleeping()) { return(Vector3.op_Addition(((Component)basePlayer).get_transform().get_position(), Vector3.op_Multiply(Vector3.get_up(), 0.1f))); } return(Vector3.op_Subtraction(basePlayer.eyes.position, Vector3.op_Multiply(Vector3.get_up(), 0.05f))); }
public Vector3 AimOffset(BaseCombatEntity aimat) { BasePlayer basePlayer = aimat as BasePlayer; if (basePlayer == null) { return(aimat.CenterPoint()); } if (basePlayer.IsSleeping()) { return(basePlayer.transform.position + (Vector3.up * 0.1f)); } return(basePlayer.eyes.position - (Vector3.up * 0.05f)); }
public Vector3 AimOffset(BaseCombatEntity aimat) { BasePlayer basePlayer = aimat as BasePlayer; if (basePlayer != null) { if (basePlayer.IsSleeping() || IsIncapacitated()) { return(basePlayer.transform.position + Vector3.up * 0.1f); } if (basePlayer.IsWounded()) { return(basePlayer.transform.position + Vector3.up * 0.25f); } return(basePlayer.eyes.position - Vector3.up * 0.15f); } return(aimat.CenterPoint()); }
public void TickAttack(float delta, BaseCombatEntity target, bool targetIsLOS) { if (target == null) { return; } if (targetIsLOS) { if (Vector3.Dot(eyes.BodyForward(), target.CenterPoint() - eyes.position) > 0.85f) { targetAimedDuration += delta; } } else { targetAimedDuration = 0f; } if (targetAimedDuration > 0.5f) { bool flag = false; if ((object)this != null) { flag = ((IAIAttack)this).IsTargetInRange((BaseEntity)target); } else { AttackEntity attackEntity = GetAttackEntity(); if ((bool)attackEntity) { flag = ((target != null) ? Vector3.Distance(base.transform.position, target.transform.position) : (-1f)) < attackEntity.effectiveRange * (attackEntity.aiOnlyInRange ? 1f : 2f); } } if (flag) { ShotTest(); } } else { CancelBurst(); } }