예제 #1
0
        public override void Draw(GameTime time)
        {
            if (Redraw)
            {
                OnRedraw();
                Redraw = false;

                //Screen.BackgroundColor = CurrentEffect is CelShadingEffect ? Color.CornflowerBlue : _Color.Black;

                // begin the knot render effect
                CurrentEffect.Begin(time);

                foreach (IGameObject obj in Objects)
                {
                    obj.World = this;
                    obj.Draw(time);
                }

                // end of the knot render effect
                CurrentEffect.End(time);
            }
            else
            {
                CurrentEffect.DrawLastFrame(time);
            }
        }
 /// <summary>
 /// Command that requests the current effect to aniamte.
 /// </summary>
 /// <param name="obj">Unused.</param>
 private void Animate(object obj)
 {
     if (CurrentEffect != null)
     {
         CurrentEffect.Animate(EffectValue1, EffectValue2, Durations[DurationIndex]);
     }
 }
예제 #3
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public void Dispose()
        {
            if (CurrentEffect != null)
            {
                CurrentEffect.Dispose();
                CurrentEffect = null;
            }

            if (effectFactory != null)
            {
                effectFactory.Dispose();
                effectFactory = null;
            }

            if (effectSetting != null)
            {
                effectSetting.Dispose();
                effectSetting = null;
            }

            if (EffectRenderer != null)
            {
                EffectRenderer.Dispose();
                EffectRenderer = null;
            }
        }
예제 #4
0
    /// <summary>
    /// Add a list of effects to the player symptoms
    /// </summary>
    /// <param name="newEffects">List of new effects</param>
    public void AddEffects(List <EffectData> newEffects)
    {
        foreach (EffectData effect in newEffects)
        {
            CurrentEffect effectData = currentEffects.Find(elem => elem.effectData.name == effect.name);

            if (effectData != null)
            {
                effectData.Reset();
            }
            else
            {
                currentEffects.Add(new CurrentEffect(effect));
                ToggleEffect(effect.name, true);
                effectList.GetComponent <EffectGenerator>().AddEffect(effect);
            }
        }
        // Apply misunderstood effect
        bool misunderstanding = currentEffects.Exists(e => e.effectData.name == "misunderstanding");

        foreach (Transform transformObject in GameObject.FindGameObjectWithTag("EffectPanel").transform.Find("EffectList").transform)
        {
            transformObject.gameObject.SetActive(!misunderstanding);
        }
        GameObject.FindGameObjectWithTag("EffectPanel").transform.Find("MisunderstoodEffectList").gameObject.SetActive(misunderstanding);
    }
예제 #5
0
 /// <summary>
 /// Entlade die Inhalte. Falls das aktuell verwendete Rendereffekt-Objekt in dieser Klasse erstellt werde, dispose es auch hier.
 /// </summary>
 public override void UnloadContent(GameTime time)
 {
     if (disposeEffect && CurrentEffect != null)
     {
         CurrentEffect.Dispose();
         CurrentEffect = null;
     }
 }
        protected override IEnumerator BufferProcess()
        {
            CurrentEffect.Action(selfCharacter);
            yield return(waiter);

            currentTime += currentTickRate;
            CurrentEffect.DisableAction(selfCharacter);
            NextEffect();
        }
예제 #7
0
        public void StartEffect(EffectBase effect)
        {
            if (CurrentEffect != null)
            {
                CurrentEffect.StopEffect();
            }

            effect.RefreshRate = SettingsManager.GetSettings().ProgramSettings.LightingSettings.RefreshRate;
            CurrentEffect      = effect;
            CurrentTask        = Task.Factory.StartNew(effect.EffectAction);
        }
예제 #8
0
        public void Dispose()
        {
            if (CurrentEffect != null)
            {
                CurrentEffect.Dispose();
                CurrentEffect = null;
            }

            if (effectFactory != null)
            {
                effectFactory.Dispose();
                effectFactory = null;
            }
        }
예제 #9
0
        /// <summary>
        /// Lade die Inhalte der Spielwelt. Falls kein Rendereffekt im Konstruktor übergeben wurde,
        /// wird der Standard-Effekt als zu verwendender Rendereffekt zugewiesen.
        /// </summary>
        public override void LoadContent(GameTime time)
        {
            if (CurrentEffect == null)
            {
                CurrentEffect = DefaultEffect(screen: Screen);

                disposeEffect = true;
                RenderEffectLibrary.RenderEffectChanged += (newEffectName, time2) => {
                    if (CurrentEffect != null)
                    {
                        CurrentEffect.Dispose();
                    }
                    CurrentEffect = RenderEffectLibrary.CreateEffect(screen: Screen, name: newEffectName);
                };
            }
        }
예제 #10
0
        protected override IEnumerator BufferProcess()
        {
            while (true)
            {
                yield return(waiter);

                if (Effects.Count > 0)
                {
                    CurrentEffect.Action(selfCharacter);
                    currentTime += 1;

                    if (CurrentEffect.MaxTime - currentTime < 0.05)
                    {
                        NextEffect();
                    }
                }
            }
        }
예제 #11
0
        public void SetEffect(string effectName, Cache.VarEquip material, int materialMeshOffset)
        {
            materialMeshOffset = GetMaterialOffset(effectName);

            // If Effect is changing - load everything
            if ((CurrentEffect == null) || (effectName != CurrentEffect.Name))
            {
                var newEffect = this.Effects.Find(x => x.Name == effectName);
                if (newEffect == null)
                {
                    throw new InvalidOperationException("Cannot find shader named " + effectName);
                }

                CurrentEffect = newEffect;
                if (material != null)
                {
                    CurrentMaterialId = material.ID;
                }
                device.VertexShader = CurrentEffect.VertexShader;
                CurrentEffect.LoadVertexShaderParameters();

                if (UsePixelShader)
                {
                    device.PixelShader = CurrentEffect.PixelShader;
                    CurrentEffect.LoadPixelShaderParameters(material, materialMeshOffset);
                }

                return;
            }

            // If only the material is changing, load shader parameters
            if (material != null && material.ID != CurrentMaterialId)
            {
                CurrentMaterialId = material.ID;
                CurrentEffect.LoadVertexShaderParameters();

                if (UsePixelShader)
                {
                    CurrentEffect.LoadPixelShaderParameters(material, materialMeshOffset);
                }

                return;
            }
        }
예제 #12
0
 void SetNewColor()
 {
     ColorLow  = Color.FromRgb(RedLow, GreenLow, BlueLow);
     ColorHigh = Color.FromRgb(RedHigh, GreenHigh, BlueHigh);
     if (CurrentEffect != null)
     {
         byte rl = (byte)(ColorLow.R * 255.0);
         byte gl = (byte)(ColorLow.G * 255.0);
         byte bl = (byte)(ColorLow.B * 255.0);
         byte rh = (byte)(ColorHigh.R * 255.0);
         byte gh = (byte)(ColorHigh.G * 255.0);
         byte bh = (byte)(ColorHigh.B * 255.0);
         for (int i = 0; i < MainPage.max_strings; ++i)
         {
             if (stringEnabled[i])
             {
                 CurrentEffect.Params[i].set_color_range(0, rl, gl, bl, rh, gh, bh);
                 CurrentEffect.Params[i].set_speed_range(0, (ushort)(speedLow_ * 50), (ushort)(speedHigh_ * 50));
                 CurrentEffect.Set(i);
             }
         }
     }
 }
예제 #13
0
 private void Select(PlayerData player)
 {
     CurrentEffect.Select(player);
     _isSelected = true;
 }
예제 #14
0
 private void Select(PlayerData player)
 {
     CurrentEffect.Select(player);
 }
예제 #15
0
        unsafe void Export()
        {
            Manager.Viewer.SetDynamicInput(
                Core.Dynamic.Inputs.Values[0].Input.Value,
                Core.Dynamic.Inputs.Values[1].Input.Value,
                Core.Dynamic.Inputs.Values[2].Input.Value,
                Core.Dynamic.Inputs.Values[3].Input.Value);

            SetLotationVelocity(
                Core.EffectBehavior.LocationVelocity.X,
                Core.EffectBehavior.LocationVelocity.Y,
                Core.EffectBehavior.LocationVelocity.Z);

            SetRotationVelocity(
                Core.EffectBehavior.RotationVelocity.X / 180.0f * 3.141592f,
                Core.EffectBehavior.RotationVelocity.Y / 180.0f * 3.141592f,
                Core.EffectBehavior.RotationVelocity.Z / 180.0f * 3.141592f);

            SetScaleVelocity(
                Core.EffectBehavior.ScaleVelocity.X,
                Core.EffectBehavior.ScaleVelocity.Y,
                Core.EffectBehavior.ScaleVelocity.Z);

            if (Core.EffectBehavior.RemovedTime.Infinite.Value)
            {
                SetRemovedTime(int.MaxValue);
            }
            else
            {
                SetRemovedTime(Core.EffectBehavior.RemovedTime.Value);
            }

            SetLotation(
                Core.EffectBehavior.Location.X,
                Core.EffectBehavior.Location.Y,
                Core.EffectBehavior.Location.Z);

            SetRotation(
                Core.EffectBehavior.Rotation.X / 180.0f * 3.141592f,
                Core.EffectBehavior.Rotation.Y / 180.0f * 3.141592f,
                Core.EffectBehavior.Rotation.Z / 180.0f * 3.141592f);

            SetScale(
                Core.EffectBehavior.Scale.X,
                Core.EffectBehavior.Scale.Y,
                Core.EffectBehavior.Scale.Z);

            SetTargetLocation(
                Core.EffectBehavior.TargetLocation.X,
                Core.EffectBehavior.TargetLocation.Y,
                Core.EffectBehavior.TargetLocation.Z);

            SetEffectCount(
                Core.EffectBehavior.CountX,
                Core.EffectBehavior.CountY,
                Core.EffectBehavior.CountZ);

            SetAllColor(
                (byte)Core.EffectBehavior.ColorAll.R,
                (byte)Core.EffectBehavior.ColorAll.G,
                (byte)Core.EffectBehavior.ColorAll.B,
                (byte)Core.EffectBehavior.ColorAll.A);

            var behavior = native.GetEffectBehavior();

            behavior.PlaybackSpeed = Core.EffectBehavior.PlaybackSpeed.Value;
            native.SetViewerEffectBehavior(behavior);

            SetEffectTimeSpan(Core.EffectBehavior.TimeSpan);

            SetEffectDistance(Core.EffectBehavior.Distance);

            SetBackgroundColor(
                (byte)Core.Environment.Background.BackgroundColor.R,
                (byte)Core.Environment.Background.BackgroundColor.G,
                (byte)Core.Environment.Background.BackgroundColor.B);

            SetGridLength(
                Core.Option.GridLength);

            SetStep((int)Core.Option.FPS.Value);
            SetIsRightHand(Core.Option.Coordinate.Value == Data.OptionValues.CoordinateType.Right);

            SetDistortionType((int)Core.Option.DistortionType.Value);
            SetRenderMode((int)Core.Option.RenderingMode.Value);

            if (Core.Culling.Type.Value == Data.EffectCullingValues.ParamaterType.Sphere)
            {
                SetCullingParameter(Core.Culling.IsShown, Core.Culling.Sphere.Radius.Value, Core.Culling.Sphere.Location.X, Core.Culling.Sphere.Location.Y, Core.Culling.Sphere.Location.Z);
            }
            else if (Core.Culling.Type.Value == Data.EffectCullingValues.ParamaterType.None)
            {
                SetCullingParameter(false, 0.0f, 0.0f, 0.0f, 0.0f);
            }

            var binaryExporter = new Binary.Exporter();
            var data           = binaryExporter.Export(Core.Root, Core.Option.Magnification);
            var path           = Utils.Misc.BackSlashToSlash(Core.Root.GetFullPath());

            fixed(byte *p = &data[0])
            {
                var newEffect = effectFactory.LoadEffect(new IntPtr(p), data.Length, path);

                native.LoadEffect(newEffect);

                if (CurrentEffect != null)
                {
                    CurrentEffect.Dispose();
                }

                CurrentEffect = newEffect;
            }
        }
예제 #16
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        unsafe void Export()
        {
            var behavior = EffectRenderer.GetBehavior();

            behavior.DynamicInput1 = Core.Dynamic.Inputs.Values[0].Input.Value;
            behavior.DynamicInput2 = Core.Dynamic.Inputs.Values[1].Input.Value;
            behavior.DynamicInput3 = Core.Dynamic.Inputs.Values[2].Input.Value;
            behavior.DynamicInput4 = Core.Dynamic.Inputs.Values[3].Input.Value;

            behavior.PositionVelocityX = Core.EffectBehavior.LocationVelocity.X;
            behavior.PositionVelocityY = Core.EffectBehavior.LocationVelocity.Y;
            behavior.PositionVelocityZ = Core.EffectBehavior.LocationVelocity.Z;

            behavior.RotationVelocityX = Core.EffectBehavior.RotationVelocity.X / 180.0f * 3.141592f;
            behavior.RotationVelocityY = Core.EffectBehavior.RotationVelocity.Y / 180.0f * 3.141592f;
            behavior.RotationVelocityZ = Core.EffectBehavior.RotationVelocity.Z / 180.0f * 3.141592f;

            behavior.ScaleVelocityX = Core.EffectBehavior.ScaleVelocity.X;
            behavior.ScaleVelocityY = Core.EffectBehavior.ScaleVelocity.Y;
            behavior.ScaleVelocityZ = Core.EffectBehavior.ScaleVelocity.Z;

            if (Core.EffectBehavior.RemovedTime.Infinite.Value)
            {
                behavior.RemovedTime = int.MaxValue;
            }
            else
            {
                behavior.RemovedTime = Core.EffectBehavior.RemovedTime.Value;
            }

            behavior.PositionX = Core.EffectBehavior.Location.X;
            behavior.PositionY = Core.EffectBehavior.Location.Y;
            behavior.PositionZ = Core.EffectBehavior.Location.Z;

            behavior.RotationX = Core.EffectBehavior.Rotation.X / 180.0f * 3.141592f;
            behavior.RotationY = Core.EffectBehavior.Rotation.Y / 180.0f * 3.141592f;
            behavior.RotationZ = Core.EffectBehavior.Rotation.Z / 180.0f * 3.141592f;

            behavior.ScaleX = Core.EffectBehavior.Scale.X;
            behavior.ScaleY = Core.EffectBehavior.Scale.Y;
            behavior.ScaleZ = Core.EffectBehavior.Scale.Z;

            behavior.TargetPositionX = Core.EffectBehavior.TargetLocation.X;
            behavior.TargetPositionY = Core.EffectBehavior.TargetLocation.Y;
            behavior.TargetPositionZ = Core.EffectBehavior.TargetLocation.Z;

            behavior.CountX = Core.EffectBehavior.CountX;
            behavior.CountY = Core.EffectBehavior.CountY;
            behavior.CountZ = Core.EffectBehavior.CountZ;

            behavior.AllColorR = (byte)Core.EffectBehavior.ColorAll.R;
            behavior.AllColorG = (byte)Core.EffectBehavior.ColorAll.G;
            behavior.AllColorB = (byte)Core.EffectBehavior.ColorAll.B;
            behavior.AllColorA = (byte)Core.EffectBehavior.ColorAll.A;

            behavior.PlaybackSpeed = Core.EffectBehavior.PlaybackSpeed.Value;

            behavior.TimeSpan = Core.EffectBehavior.TimeSpan;
            behavior.Distance = Core.EffectBehavior.Distance;

            EffectRenderer.SetBehavior(behavior);

            EffectRenderer.SetStep((int)Core.Option.FPS.Value);

            effectSetting.SetCoordinateSyatem(
                Core.Option.Coordinate.Value == Data.OptionValues.CoordinateType.Right ? swig.CoordinateSystemType.RH : swig.CoordinateSystemType.LH);

            var binaryExporter = new Binary.Exporter();
            var data           = binaryExporter.Export(Core.Root, Core.Option.Magnification);
            var path           = Utils.Misc.BackSlashToSlash(Core.Root.GetFullPath());

            fixed(byte *p = &data[0])
            {
                var newEffect = effectFactory.LoadEffect(new IntPtr(p), data.Length, path);

                EffectRenderer.SetEffect(newEffect);

                if (CurrentEffect != null)
                {
                    CurrentEffect.Dispose();
                }

                CurrentEffect = newEffect;
            }
        }