Exemple #1
0
        public bool CanSeeItemOfInterest(IItemOfInterest itemOfInterest, bool requireFieldOfView)
        {
            //if it's a visible item
            //we'll want to access its visibility modifiers
            IVisible mVisibleItemCheck = (IVisible)itemOfInterest;

            if (mVisibleItemCheck != null)
            {
                return(CanSeeVisibleItem(mVisibleItemCheck, requireFieldOfView));
            }

            //otherwise we'll just check the item without multipliers
            //we calculate this every time because it could change due to external modifiers
            float mAwarenessDistance = Looker.AwarenessDistanceTypeToVisibleDistance(State.AwarenessDistance);

            if (State.ManualAwarenessDistance > 0)
            {
                mAwarenessDistance = State.ManualAwarenessDistance;
            }

            if (Looker.IsInVisibleRange(worlditem.Position, itemOfInterest.Position, mAwarenessDistance))
            {
                if (!requireFieldOfView || Looker.IsInFieldOfView(worlditem.tr.forward, worlditem.Position, State.FieldOfView, itemOfInterest.Position))
                {
                    //it's in our field of view AND it's close enough to see
                    //check to see if we can see it with the visible item's modifiers in place
                    return(true);
                }
            }

            return(false);
        }
Exemple #2
0
        public bool CanSeeVisibleItem(IVisible visibleItem, bool requireFieldOfView)
        {
            //we calculate this every time because it could change due to external modifiers
            mAwarenessDistance = Looker.AwarenessDistanceTypeToVisibleDistance(State.AwarenessDistance);
            if (State.ManualAwarenessDistance > 0)
            {
                mAwarenessDistance = State.ManualAwarenessDistance;
            }

            if (Looker.IsInVisibleRange(worlditem.Position, visibleItem.Position, mAwarenessDistance) &&
                (!requireFieldOfView || Looker.IsInFieldOfView(worlditem.tr.forward, worlditem.Position, State.FieldOfView, visibleItem.Position)))
            {
                //it's in our field of view AND it's close enough to see
                //check to see if we can see it with the visible item's modifiers in place
                if (visibleItem.IsVisible && Looker.IsInVisibleRange(worlditem.Position, visibleItem.Position, mAwarenessDistance * visibleItem.AwarenessDistanceMultiplier) &&
                    (!requireFieldOfView || Looker.IsInFieldOfView(worlditem.tr.forward, worlditem.Position, State.FieldOfView * visibleItem.FieldOfViewMultiplier, visibleItem.Position)))
                {
                    return(true);
                }
            }

            visibleItem.LookerFailToSee();
            return(false);
        }