• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Effect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: UpdatedUsedParameters

        public void UpdatedUsedParameters(Effect effect, ParameterCollection parameters)
        {
            // Try to update counters only if possible
            var internalValues = parameters.InternalValues;
            bool parameterKeyMatches = SortedCounters.Length == internalValues.Count;

            if (parameterKeyMatches)
            {
                for (int i = 0; i < internalValues.Count; ++i)
                {
                    if (SortedKeys[i] != internalValues[i].Key)
                    {
                        parameterKeyMatches = false;
                        break;
                    }
                    SortedCounters[i] = internalValues[i].Value.Counter;
                }
            }

            // Somehow, the used parameters changed, we need a full reset
            if (!parameterKeyMatches)
            {
                Initialize(effect, parameters);
            }
        }
开发者ID:dejavvu,项目名称:paradox,代码行数:25,代码来源:DynamicEffectParameterUpdaterDefinition.cs


示例17: RenderModel

        void RenderModel(Graphics.Content.Model10 model, SlimDX.Matrix entityWorld, Effect effect)
        {
            throw new NotImplementedException();
            //if (model == null || !model.Visible || model.Mesh == null) return;

            Matrix world = model.World * entityWorld;
            world.M41 = (float)((int)world.M41);
            world.M42 = (float)((int)world.M42);
            world *= Matrix.Scaling(2f / (float)view.Viewport.Width, 2f / (float)view.Viewport.Height, 1) * Matrix.Translation(-1, -1, 0) * Matrix.Scaling(1, -1, 1);
            world.M43 = 0.5f;

            effect.GetVariableByName("World").AsMatrix().SetMatrix(world);
            effect.GetVariableByName("Texture").AsResource().SetResource(model.TextureShaderView);

            effect.GetTechniqueByName("Render").GetPassByIndex(0).Apply();
            if (model.Mesh != null)
            {
                model.Mesh.Setup(view.Device10, view.Content.Acquire<InputLayout>(
                    new Content.VertexStreamLayoutFromEffect
                {
                    Signature10 = effect.GetTechniqueByIndex(0).GetPassByIndex(0).Description.Signature,
                    Layout = model.Mesh.VertexStreamLayout
                }));

                model.Mesh.Draw(device);
            }
        }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:27,代码来源:InterfaceRenderer10.cs


示例18: Tower

    //Constructor
    public Tower(int x, int z, Effect.EffectType effect, bool pastState, int direction, int eEntry)
    {
        towerXPos = x;
        towerZPos = z;
        this.effect = new Effect (effect);
        direct = direction;
        Debug.Log (direction + " " + eEntry);
        enemyEntry = eEntry;

        //direct = dir;
        active = true;

        animHelper = 0;

        /*towerObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
        towerObj.renderer.enabled = true;
        towerObj.transform.position = new Vector3(towerXPos, 0, towerZPos);
        towerObj.transform.localScale = new Vector3(1f,0.5f,1f);
        towerObj.transform.Rotate(0,0,180);
        towerObj.transform.tag = "tower";*/

        // New Model Initialization
        GameObject towerPrefab = PrefabFactory.GetTowerPrefab();
        GameManager.InstantiateModel(towerPrefab, new Vector3(x,0,z));
        towerObj = GameObject.Find("TowerPrefab(Clone)");
        towerObj.transform.tag = "tower";

        crystal = towerObj.transform.Find("Sphere").gameObject;
        upperRing = towerObj.transform.Find("UpperRing").gameObject;
        lowerRing = towerObj.transform.Find("LowerRing").gameObject;

        this.pastState = pastState;

        if (effect == Effect.EffectType.Fire){
            towerName = "Single Fire Tower ["+x+","+z+"]";
            if (pastState == true){
                //SetTextureTower(TextureFactory.GetFireTowerPast());
                towerObj.name = towerName; //+ " (Past)";
            }
            else {
                //SetTextureTower(TextureFactory.GetFireTowerFuture());
                towerObj.name = towerName; //+ " (Future)";
                SetTowerObjColor(ColorFactory.GetLightRed());
            }
        }

        if (effect == Effect.EffectType.Ice){
            towerName = "Area of Effect Tower ["+x+","+z+"]";
            if (pastState == true){
                //SetTextureTower(TextureFactory.GetIceTowerPast());
                towerObj.name = towerName; //+ " (Past)";
            }
            else {
                //SetTextureTower(TextureFactory.GetIceTowerFuture());
                towerObj.name = towerName; //+ " (Future)";
                SetTowerObjColor(ColorFactory.GetLightBlue());
            }
        }
        CreateZone();
    }
开发者ID:Duelist,项目名称:Project-Reach,代码行数:61,代码来源:Tower.cs


示例19: InitializeCore

        protected override void InitializeCore()
        {
            base.InitializeCore();

            backgroundEffect = new Effect(Context.GraphicsDevice, BackgroundEffect.Bytecode) { Name = "BackgroundEffect" };
            spriteBatch = new SpriteBatch(Context.GraphicsDevice) { VirtualResolution = new Vector3(1)};
        }
开发者ID:releed,项目名称:paradox,代码行数:7,代码来源:BackgroundComponentRenderer.cs


示例20: StartMe

    // Use this for initialization
    public void StartMe()
    {
        /*
         * Don't let them get goggles if they already have goggles or if they're the scout.
         */
        if (Player.MyPlayer.GetComponent<Player>().GetStatValue(Stat.VISION) == 3 ||
                Player.MyPlayer.GetComponent<Player>().GetPlayerClassObject().GetClassTypeEnum() == Classes.SCOUT) {
            Destroy(this);
            return;
        }

        Log();
        ObjectiveName = "AlienSecondaryTwo";
        Title = "Steal Goggles";
        Description = "Steal the night vision goggles.\n" +
            "REWARD: extra vision." + StringMethodsScript.NEWLINE;
        GameObject objective = PickAlienObjective();
        Location = Tile.TilePosition(objective.transform.position);

        interactable =
            objective.AddComponent<AlienSecondaryTwoInteractable>();
        interactable.InstantInteract = true;
        interactable.StartMe();

        visionEffect = new StatusTurnEffect(Stat.VISION, 3.0, 1,
                                        "Dimmed Lights: Vision Increased", "Icons/Effects/alienvisionpurple", -1, true);
    }
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:28,代码来源:AlienSecondaryTwo.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EffectFlags类代码示例发布时间:2022-05-24
下一篇:
C# EdmVersion类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap