GameFramework.EntityInfo.CanSee C# (CSharp) Method

CanSee() public static method

public static CanSee ( EntityInfo source, EntityInfo target ) : bool
source EntityInfo
target EntityInfo
return bool
        public static bool CanSee(EntityInfo source, EntityInfo target)
        {
            bool ret = false;
            if (null != source && null != target) {
                Vector3 pos1 = source.GetMovementStateInfo().GetPosition3D();
                Vector3 pos2 = target.GetMovementStateInfo().GetPosition3D();
                float distSqr = GameFramework.Geometry.DistanceSquare(pos1, pos2);
                return CanSee(source, target, distSqr, pos1, pos2);
            }
            return ret;
        }

Same methods

EntityInfo::CanSee ( EntityInfo source, EntityInfo target, float distSqr, System.Vector3 pos1, System.Vector3 pos2 ) : bool

Usage Example

        private static bool CanSee(EntityInfo src, EntityInfo target)
        {
            int srcCampId    = src.GetCampId();
            int targetCampId = target.GetCampId();

            if (srcCampId == targetCampId)
            {
                return(true);
            }
            else if (srcCampId == (int)CampIdEnum.Hostile || targetCampId == (int)CampIdEnum.Hostile)
            {
                return(EntityInfo.CanSee(src, target));
            }
            else
            {
                return(true);
            }
        }