Exemplo n.º 1
0
        public bool IsVisibleTo(IDrawDevice device)
        {
            if (this.IsDirectional)
            {
                return(true);
            }
            if (this.range <= 0.0f)
            {
                return(false);
            }
            if (this.intensity <= 0.0f)
            {
                return(false);
            }

            float uniformScale = this.GameObj.Transform.Scale;

            if (uniformScale <= 0.0f)
            {
                return(false);
            }

            Vector3 pos = this.GameObj.Transform.Pos;

            if (device.IsSphereInView(pos, this.range * uniformScale))
            {
                return(true);
            }
            if (device.IsSphereInView(pos - Vector3.UnitZ * this.range * 0.5f * uniformScale, this.range * uniformScale))
            {
                return(true);
            }
            if (device.IsSphereInView(pos + Vector3.UnitZ * this.range * uniformScale, this.range * uniformScale))
            {
                return(true);
            }
            return(false);
        }