/// <summary> /// 判断一个地块是否可见 /// </summary> /// <param name="shadowLine"></param> /// <param name="projection"></param> /// <returns></returns> bool IsVisible(ShadowLine shadowLine, Shadow projection) { return(!shadowLine.AllInShadow(projection)); // 如果这个地块的投影完全在阴影线的阴影里,则认为这个地块是不可见的 }
/// <summary> /// 判断一个地块是否遮挡视线 /// </summary> /// <param name="shadowLine"></param> /// <param name="currentPosition"></param> /// <param name="projection"></param> /// <returns></returns> bool IsBlockView(ShadowLine shadowLine, Vector2 currentPosition, Shadow projection) { return(!shadowLine.AllInShadow(projection) && !_visiableMap.IsTransparent(currentPosition)); // 如果这个地块没有完全处于阴影中,并且这个地块不透明,说明会遮挡视线 }