public float CalculateAggroForTarget(ISightTarget target)
        {
            var info = target.GetInfoFromObserver(_observerAggro.observer);

            if (info != null)
            {
                return((_observerAggro.observer.config.viewingDistance - info.distance) / _observerAggro.observer.config.viewingDistance * intensity);
            }

            return(0f);
        }
        public float CalculateAggroForTarget(ISightTarget target)
        {
            var info = target.GetInfoFromObserver(_observerAggro.observer);

            if (info != null)
            {
                return(Mathf.Clamp(info.visibleForSeconds, 0f, maxTime) * intensity);
            }

            return(0f);
        }
        public float CalculateAggroForTarget(ISightTarget target)
        {
            var info = target.GetInfoFromObserver(_observerAggro.observer); // Safe to assume info is available here, considering we're getting the update call.

            if (info == null || info.lastSeenAt.HasValue == false)
            {
                return(0f);
            }

            return(Vector3.Dot(_observerAggro.observer.transform.forward, Vector3.Normalize(target.transform.position - _observerAggro.observer.transform.position)) * intensity);
        }
Exemplo n.º 4
0
        public float CalculateAggroForTarget(ISightTarget target)
        {
            var info = target.GetInfoFromObserver(_observerAggro.observer);

            if (info != null)
            {
                return(info.visibleFactor * intensity);
            }

            return(0f);
        }
        public float CalculateAggroForTarget(ISightTarget target)
        {
            var info = target.GetInfoFromObserver(_observerAggro.observer);

            if (info != null && info.lastSeenAt.HasValue)
            {
                var diff    = (info.lastSeenAt.Value.time - LosUtility.time);
                var diffAbs = Mathf.Abs(diff);
                if (diffAbs > startAfterInvisibleTime)
                {
                    if (diffAbs > forgetTargetAfterSecondsInvisible)
                    {
                        _observerAggro.ForgetTarget(target);
                    }

                    return(diff * intensity);
                }
            }

            return(0f);
        }