Example #1
0
        public bool IsEntityVisibleInCustomOffset(BaseMonoEntity entity, float fovOffset, float nearOffset, float farOffset)
        {
            bool   flag            = false;
            float  fieldOfView     = this.cameraComponent.fieldOfView;
            float  nearClipPlane   = this.cameraComponent.nearClipPlane;
            float  farClipPlane    = this.cameraComponent.farClipPlane;
            Camera cameraComponent = this.cameraComponent;

            cameraComponent.fieldOfView += fovOffset;
            Camera camera2 = this.cameraComponent;

            camera2.nearClipPlane += nearOffset;
            Camera camera3 = this.cameraComponent;

            camera3.farClipPlane += farOffset;
            Matrix4x4 projectionMatrix = this.cameraComponent.projectionMatrix;
            Collider  component        = entity.GetComponent <Collider>();

            if ((component != null) && component.enabled)
            {
                flag = GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(projectionMatrix), component.bounds);
            }
            Vector3 vector = this.cameraComponent.WorldToViewportPoint(entity.XZPosition);

            flag = ((vector.z > 0f) && Miscs.IsFloatInRange(vector.x, 0f, 1f)) && Miscs.IsFloatInRange(vector.y, 0f, 1f);
            this.cameraComponent.fieldOfView   = fieldOfView;
            this.cameraComponent.nearClipPlane = nearClipPlane;
            this.cameraComponent.farClipPlane  = farClipPlane;
            return(flag);
        }
Example #2
0
        public void SetupOverride(BaseMonoEntity owner)
        {
            MonoEffectOverride component = owner.GetComponent <MonoEffectOverride>();

            if (component != null)
            {
                MonoEffectPluginTrailSmooth smooth = base.GetComponent <MonoEffectPluginTrailSmooth>();
                if (smooth != null)
                {
                    smooth.HandleEffectOverride(component);
                }
                else
                {
                    MonoEffectPluginTrailStatic @static = base.GetComponent <MonoEffectPluginTrailStatic>();
                    if (@static != null)
                    {
                        @static.HandleEffectOverride(component);
                    }
                }
                MonoEffectPluginOverrideHandler handler = base.GetComponent <MonoEffectPluginOverrideHandler>();
                if (handler != null)
                {
                    handler.HandleEffectOverride(component);
                }
            }
        }
Example #3
0
        public void TriggerEntityEffectPatternRaw(string patternName, Vector3 initPos, Vector3 initDir, Vector3 initScale, BaseMonoEntity entity, out List <MonoEffect> effects)
        {
            MonoEffectOverride component = entity.GetComponent <MonoEffectOverride>();

            if ((component != null) && component.effectOverrides.ContainsKey(patternName))
            {
                patternName = component.effectOverrides[patternName];
            }
            EffectPattern effectPattern = EffectData.GetEffectPattern(patternName);

            effects = new List <MonoEffect>();
            if (effectPattern.randomOneFromSubs)
            {
                int[] list = new int[effectPattern.subEffects.Length];
                for (int i = 0; i < list.Length; i++)
                {
                    list[i] = i;
                }
                list.Shuffle <int>();
                for (int j = 0; j < list.Length; j++)
                {
                    if (((component == null) || string.IsNullOrEmpty(effectPattern.subEffects[j].predicate)) || component.effectPredicates.Contains(effectPattern.subEffects[j].predicate))
                    {
                        BaseMonoEffect effect = this.CreateEffectInstanceBySubEffectConfig(effectPattern.subEffects[j], initPos, initDir, initScale, entity);
                        if ((effect != null) && (effect is MonoEffect))
                        {
                            effects.Add((MonoEffect)effect);
                            break;
                        }
                    }
                }
            }
            else if (effectPattern.subEffects.Length == 1)
            {
                BaseMonoEffect effect2 = this.CreateEffectInstanceBySubEffectConfig(effectPattern.subEffects[0], initPos, initDir, initScale, entity);
                if ((effect2 != null) && (effect2 is MonoEffect))
                {
                    effects.Add((MonoEffect)effect2);
                }
            }
            else
            {
                for (int k = 0; k < effectPattern.subEffects.Length; k++)
                {
                    if (((component == null) || string.IsNullOrEmpty(effectPattern.subEffects[k].predicate)) || component.effectPredicates.Contains(effectPattern.subEffects[k].predicate))
                    {
                        BaseMonoEffect effect3 = this.CreateEffectInstanceBySubEffectConfig(effectPattern.subEffects[k], initPos, initDir, initScale, entity);
                        if ((effect3 != null) && (effect3 is MonoEffect))
                        {
                            effects.Add((MonoEffect)effect3);
                        }
                    }
                }
            }
        }
Example #4
0
        public bool IsEntityVisible(BaseMonoEntity entity)
        {
            Collider component = entity.GetComponent <Collider>();

            if ((component != null) && component.enabled)
            {
                return(GeometryUtility.TestPlanesAABB(this._frustumPlanes, component.bounds));
            }
            Vector3 vector = this.cameraComponent.WorldToViewportPoint(entity.XZPosition);

            return(((vector.z > 0f) && Miscs.IsFloatInRange(vector.x, 0f, 1f)) && Miscs.IsFloatInRange(vector.y, 0f, 1f));
        }