当前位置: 首页>>代码示例>>C#>>正文


C# Effect类代码示例

本文整理汇总了C#中Effect的典型用法代码示例。如果您正苦于以下问题:C# Effect类的具体用法?C# Effect怎么用?C# Effect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Effect类属于命名空间,在下文中一共展示了Effect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AlienPrimaryAbility

    List<AudioClip> transformEfx; // Transform sound effects

    #endregion Fields

    #region Constructors

    /**
     * Constructor
     *
     * Arguments
     * - Player player - The owner of this ability
     */
    public AlienPrimaryAbility(Player player)
    {
        GameObject alienModel = null, humanModel = null; // The models of the player

        AbilityName = "Alien Mode";
        Range = 0.0; // No range
        AbilityRangeType = RangeType.GLOBALTARGETRANGE;
        AbilityActivationType = ActivationType.SUPPORTIVE;

        owner = player;

        /*
         * For the model, need to do many things, such as getting the game object of
         * the player's model
         */
        foreach (Transform objectTransform in player.gameObject.transform) {
            if (objectTransform.gameObject.name.Equals("HybridHuman")) // Found human model
                humanModel = objectTransform.gameObject;
            else if (objectTransform.gameObject.name.Equals("alien")) // Found alien model
                alienModel = objectTransform.gameObject;

            if (alienModel != null && humanModel != null)
                break;
        }
        changeModel = new ModelChangeTurnEffect(alienModel, humanModel, owner.gameObject, "Alien Mode: Shape Change",
                "Icons/Effects/alienmodepurple", -1, false);

        secondaryEffectRewards = new List<Effect>();

        transformEfx = new List<AudioClip>();
        transformEfx.Add(Resources.Load<AudioClip>("Audio/Sound Effects/Alien_transform"));
        if (transformEfx.Count != 1) {
            Debug.LogError("Invalid sound effect path for alien transforming");
        }
    }
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:47,代码来源:AlienPrimaryAbility.cs

示例2: VisualEffect

        protected VisualEffect(IServiceProvider services, string effectAsset,
            int effectLayerCount, IEnumerable<RenderTargetLayerType> requiredRenderTargets)
        {
            if (services == null)
                throw new ArgumentNullException("services");
            if (effectAsset == null)
                throw new ArgumentNullException("effectAsset");
            if (requiredRenderTargets == null)
                throw new ArgumentNullException("requiredRenderTargets");
            if (effectLayerCount < 0)
                throw new ArgumentOutOfRangeException("affectedLayers", "Parameter should have non-negative value.");

            renderer = (Renderer)services.GetService(typeof(Renderer));
            resourceManager = (ResourceManager)services.GetService(typeof(ResourceManager));

            this.requiredRenderTargets = requiredRenderTargets;
            this.effectLayerCount = effectLayerCount > 0 ? effectLayerCount : renderer.KBufferManager.Configuration.LayerCount;

            effect = resourceManager.Load<Effect>(effectAsset);
            effectTechnique = effect.GetTechniqueByName(VisualEffectTechniqueName);
            if (!effectTechnique.IsValid)
                throw new ArgumentException(
                    string.Format("Given effect asset '{0}' does not contain technique {1}.", effectAsset, VisualEffectTechniqueName),
                    "effectAsset");
        }
开发者ID:TheProjecter,项目名称:romantiquex,代码行数:25,代码来源:VisualEffect.cs

示例3: EffectParameterUpdaterLayout

        public EffectParameterUpdaterLayout(GraphicsDevice graphicsDevice, Effect effect, DescriptorSetLayoutBuilder[] layouts)
        {
            Layouts = layouts;

            // Process constant buffers
            ResourceGroupLayouts = new ResourceGroupLayout[layouts.Length];
            for (int layoutIndex = 0; layoutIndex < layouts.Length; layoutIndex++)
            {
                var layout = layouts[layoutIndex];
                if (layout == null)
                    continue;

                ParameterCollectionLayout.ProcessResources(layout);

                EffectConstantBufferDescription cbuffer = null;

                for (int entryIndex = 0; entryIndex < layout.Entries.Count; ++entryIndex)
                {
                    var layoutEntry = layout.Entries[entryIndex];
                    if (layoutEntry.Class == EffectParameterClass.ConstantBuffer)
                    {
                        // For now we assume first cbuffer will be the main one
                        if (cbuffer == null)
                        {
                            cbuffer = effect.Bytecode.Reflection.ConstantBuffers.First(x => x.Name == layoutEntry.Key.Name);
                            ParameterCollectionLayout.ProcessConstantBuffer(cbuffer);
                        }
                    }
                }

                var resourceGroupDescription = new ResourceGroupDescription(layout, cbuffer);

                ResourceGroupLayouts[layoutIndex] = ResourceGroupLayout.New(graphicsDevice, resourceGroupDescription, effect.Bytecode);
            }
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:35,代码来源:EffectParameterUpdaterLayout.cs

示例4: SetUp

        public void SetUp()
        {
            AppControl.SetUpApplication();
            engine = new MultipleEffect3DEngine() { D3DDevice = new MultipleOutputDevice() { NumAdditionalTargets = 1 } };
            effect = new WorldViewProjEffect() { ShaderFilename = @"Effects\ClipmapTerrain_w_GSOut.fx" };
            engine.AddEffect(effect);
            hiresCtm = new ClipmapTerrainManager(engine, effect)
            {
                WidthInTiles = widthInTiles,
                WidthOfTiles = widthOfTiles,
                TextureVariableName = "HiresTexture",
                StartingLongLat = startingLongLat
            };
            loresCtm = new ClipmapTerrainManager(engine, effect)
            {
                WidthInTiles = widthInTiles,
                WidthOfTiles = widthOfTiles,
                TextureVariableName = "LoresTexture",
                TerrainFetcher = new Srtm30TextureFetcher(),
                StartingLongLat = startingLongLat
            };
            etm = new ExTerrainManager(engine,effect) { AutoAdjustScaleBasedOnHeight = true};
            form = new D3DHostForm();

            form.SetEngine(engine);
        }
开发者ID:adrianj,项目名称:Direct3D-Testing,代码行数:26,代码来源:TestClipmapTerrainManager.cs

示例5: LoadContent

        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var view = Matrix.LookAtRH(new Vector3(2,2,2), new Vector3(0, 0, 0), Vector3.UnitY);
            var projection = Matrix.PerspectiveFovRH((float)Math.PI / 4.0f, (float)GraphicsDevice.BackBuffer.ViewWidth / GraphicsDevice.BackBuffer.ViewHeight, 0.1f, 100.0f);
            worldViewProjection = Matrix.Multiply(view, projection);

            geometry = GeometricPrimitive.Cube.New(GraphicsDevice);
            simpleEffect = new Effect(GraphicsDevice, SpriteEffect.Bytecode);
            parameterCollection = new ParameterCollection();
            parameterCollectionGroup = new EffectParameterCollectionGroup(GraphicsDevice, simpleEffect, new[] { parameterCollection });
            parameterCollection.Set(TexturingKeys.Texture0, UVTexture);
            
            // TODO DisposeBy is not working with device reset
            offlineTarget0 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);

            offlineTarget1 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);
            offlineTarget2 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this);

            depthBuffer = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.D16_UNorm, TextureFlags.DepthStencil).DisposeBy(this);

            width = GraphicsDevice.BackBuffer.ViewWidth;
            height = GraphicsDevice.BackBuffer.ViewHeight;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:25,代码来源:TestRenderToTexture.cs

示例6: makeEffect

        private static Effect makeEffect(string effectName, EffectType2 type)
        {
            Effect effect = new Effect() {Name = effectName};
            effect.Type = type;
            switch (effect.Type) {
                case EffectType2.Highlight:
                    effect.Properties.Add(new EffectProperty() {Name = "Radius", Value = 5, Type = EffectPropertyType.Number});
                    effect.Properties.Add(new EffectProperty() {Name = "Color", Value = "#242444", Type = EffectPropertyType.Color});
                    effect.Properties.Add(new EffectProperty() {Name = "Opacity", Value = 0.5, Type = EffectPropertyType.Number});
                    effect.Properties.Add(new EffectProperty() {Name = "Rotate", Value = 0, Type = EffectPropertyType.Number});
                    effect.Properties.Add(new EffectProperty() {Name = "OffsetX", Value = 0, Type = EffectPropertyType.Number});
                    effect.Properties.Add(new EffectProperty() {Name = "OffsetY", Value = 0, Type = EffectPropertyType.Number});
                    break;
                case EffectType2.Rotate:
                    effect.Properties.Add(new EffectProperty() {Name = "Degrees", Value = 90, Type = EffectPropertyType.Number});
                    break;
                case EffectType2.Bend:
                    effect.Properties.Add(new EffectProperty() {Name = "Degrees", Value = 15, Type = EffectPropertyType.Number});
                    break;
                case EffectType2.StyleProperty:
                    effect.Properties.Add(new EffectProperty() {Name = "Property Name", Value = "background-color", Type = EffectPropertyType.Text});
                    effect.Properties.Add(new EffectProperty() {Name = "Property Value", Value = "red", Type = EffectPropertyType.Text});
                    break;
                case EffectType2.Animated:
                    effect.Properties.Add(new EffectProperty() {Name = "idk", Value = "rite?", Type = EffectPropertyType.Text});
                    break;
            }

            return effect;
        }
开发者ID:Shuffle-Game,项目名称:ShufflySharp,代码行数:30,代码来源:ListEffectsController.cs

示例7: GroundOnTimeAppliedEffect

 public GroundOnTimeAppliedEffect(int id, Effect effect, int nbTurn, Character caster)
 {
     _id = id;
     _effect = effect;
     _nbTurn = nbTurn;
     _caster = caster;
 }
开发者ID:LilTsubaki,项目名称:Les-fragments-d-Erule,代码行数:7,代码来源:GroundOnTimeAppliedEffect.cs

示例8: applyToEffect

 public virtual void applyToEffect(Effect effect)
 {
     effect.SetValue("lightColor", ColorValue.FromColor(this.color));
     effect.SetValue("lightPosition", TgcParserUtils.vector3ToFloat4Array(this.position));
     effect.SetValue("lightIntensity", this.intensity);
     effect.SetValue("lightAttenuation", this.attenuation);
 }
开发者ID:pablitar,项目名称:tgc-mirrorball,代码行数:7,代码来源:Lights.cs

示例9: Initialize

        private void Initialize(Effect effect, ParameterCollection usedParameters)
        {
            if (effect == null) throw new ArgumentNullException("effect");

            // TODO: Should we ignore various compiler keys such as CompilerParameters.GraphicsPlatformKey, CompilerParameters.GraphicsProfileKey and CompilerParameters.DebugKey?
            //       That was done previously in Effect.CompilerParameters
            // TODO: Should we clone usedParameters? Or somehow make sure it is immutable? (for now it uses the one straight from EffectCompiler, which might not be a good idea...)
            Parameters = usedParameters;
            var parameters = usedParameters;

            var internalValues = parameters.InternalValues;
            SortedKeys = new ParameterKey[internalValues.Count];
            SortedKeyHashes = new ulong[internalValues.Count];
            SortedCompilationValues = new object[internalValues.Count];
            SortedCounters = new int[internalValues.Count];

            for (int i = 0; i < internalValues.Count; ++i)
            {
                var internalValue = internalValues[i];

                SortedKeys[i] = internalValue.Key;
                SortedKeyHashes[i] = internalValue.Key.HashCode;
                SortedCompilationValues[i] = internalValue.Value.Object;
                SortedCounters[i] = internalValue.Value.Counter;
            }

            var keyMapping = new Dictionary<ParameterKey, int>();
            for (int i = 0; i < SortedKeys.Length; i++)
                keyMapping.Add(SortedKeys[i], i);
            Parameters.SetKeyMapping(keyMapping);
        }
开发者ID:dejavvu,项目名称:paradox,代码行数:31,代码来源:DynamicEffectParameterUpdaterDefinition.cs

示例10: Setup

        public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
        {
            base.Setup(_game, _keyboard, _message);

            Sprite title = new Sprite(new Bitmap("pictures/title.png"));
            title.Position = new Vector2f();
            title.Size = new Vector2f(Game.Width, Game.Height);

            m_house.AddDrawable(title);

            Text text = new Text("[Click] or Press [Space] to Start");
            text.CentreOn(new Vector2f(Game.Width/2, Game.Height/5));

            m_house.AddDrawable(text);

            fx_buffer
                = new Effect(
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
                    new Vector2i(Game.Width, Game.Height)) {
                CaptureLayer = Layer.Normal,
                Layer = Layer.FX,
                Priority = Priority.Front
            };
            fx_buffer.SetHUD(_game.Camera);
            fx_buffer.SetFading(0.5f, new Colour(0,0,0,1), new Colour(0,0,0,0));
            m_house.AddDrawable(fx_buffer);
            m_house.AddUpdateable(fx_buffer);
        }
开发者ID:joebain,项目名称:MagnumHouse,代码行数:29,代码来源:TitleScreen.cs

示例11: Initialize

 public void Initialize(Device device, Effect effect)
 {
     this.device = device;
     this.effect = effect;
     image = ImageConverter.GetNullTexture(device);
     Update();
 }
开发者ID:adrianj,项目名称:Direct3D-Testing,代码行数:7,代码来源:TextureHelper.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     Effect e = new Effect (transform.position, lightningStrike, 0.5f);
     e = new Effect (transform.position + Vector3.down*smokeHeight, smoke, 5);
     e = new Effect (transform.position, sound, 3);
     e = new Effect (new Vector3(0,0,0), background, 0.5f);
 }
开发者ID:CapsE,项目名称:Butt-on-Smash,代码行数:8,代码来源:LightningStrikeBehaviour.cs

示例13: LoadResources

        public override void LoadResources()
        {
            string base_path = (string)settings["Base.Path"];
            // load effect
            string errors;
            effect = Effect.FromFile(device, base_path + "Media/Effects/Bloom-new.fx", null, null,
                                      ShaderFlags.None, null, out errors);

            if (errors.Length > 0)
                throw new Exception("HLSL compile error");

            brightPass = effect.GetTechnique("std_BloomBrightPass");
            blurPass = effect.GetTechnique("std_BlurPass");
            finalPass = effect.GetTechnique("std_FinalPass");

            bpQuad = new CustomVertex.TransformedTextured[4];
            bpQuad[0].Tu = 0;
            bpQuad[0].Tv = 0;
            bpQuad[1].Tu = 1;
            bpQuad[1].Tv = 0;
            bpQuad[2].Tu = 0;
            bpQuad[2].Tv = 1;
            bpQuad[3].Tu = 1;
            bpQuad[3].Tv = 1;

            //testTexture = TextureLoader.FromFile(device, "c:/blurTest.bmp", 256, 128, 0, Usage.None, Format.X8R8G8B8, Pool.Managed, Filter.None, Filter.None, 0);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:27,代码来源:BloomEffect.cs

示例14: Awake

 void Awake()
 {
     var effect = GetComponent<Effect>();
     if (effect != null) {
         this.effect = effect;
     }
 }
开发者ID:craus,项目名称:UnityTest,代码行数:7,代码来源:AbstractTrigger.cs

示例15: LoadContent

        protected override void LoadContent()
        {
            // Loads the effect
            metaTunnelEffect = Content.Load<Effect>("metatunnel.fxo");

            base.LoadContent();
        }
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:7,代码来源:CustomEffectGame.cs


注:本文中的Effect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。