本文整理汇总了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");
}
}
示例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");
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例7: GroundOnTimeAppliedEffect
public GroundOnTimeAppliedEffect(int id, Effect effect, int nbTurn, Character caster)
{
_id = id;
_effect = effect;
_nbTurn = nbTurn;
_caster = caster;
}
示例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);
}
示例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);
}
示例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);
}
示例11: Initialize
public void Initialize(Device device, Effect effect)
{
this.device = device;
this.effect = effect;
image = ImageConverter.GetNullTexture(device);
Update();
}
示例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);
}
示例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);
}
示例14: Awake
void Awake()
{
var effect = GetComponent<Effect>();
if (effect != null) {
this.effect = effect;
}
}
示例15: LoadContent
protected override void LoadContent()
{
// Loads the effect
metaTunnelEffect = Content.Load<Effect>("metatunnel.fxo");
base.LoadContent();
}