本文整理汇总了C#中EffectNode类的典型用法代码示例。如果您正苦于以下问题:C# EffectNode类的具体用法?C# EffectNode怎么用?C# EffectNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EffectNode类属于命名空间,在下文中一共展示了EffectNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttractionForceAffector
public AttractionForceAffector(float magnitude, Vector3 pos, EffectNode node)
: base(node)
{
Magnitude = magnitude;
Position = pos;
UseCurve = false;
}
示例2: TimedSequenceEditorEffectEditor
public TimedSequenceEditorEffectEditor(EffectNode effectNode)
{
InitializeComponent();
_effectNode = effectNode;
IEnumerable<IEffectEditorControl> controls = ApplicationServices.GetEffectEditorControls(_effectNode.Effect.Descriptor.TypeId);
if (controls == null) {
Label l = new Label();
l.Text = "Can't find any effect editors that can edit this effect!";
l.Anchor = AnchorStyles.None;
tableLayoutPanelEffectEditors.Controls.Add(l);
tableLayoutPanelEffectEditors.SetColumnSpan(l, 2);
return;
}
_controls = new List<IEffectEditorControl>();
object[] values = _effectNode.Effect.ParameterValues;
// if there were multiple controls returned, or there was only a single control needed (ie. the efffect parameters had only
// a single item) then add controls inside a ParameterEditor wrapper using editors for that type, and label them appropriately.
// if it was only a single control returned, it must have matched the entire effect (by GUID or signature), so just dump the
// control it, and let it deal with everything it needs to.
if (controls.Count() > 1 || (controls.Count() == 1 && (_effectNode.Effect.Descriptor as IEffectModuleDescriptor).Parameters.Count == 1)) {
_usedSingleControl = false;
int i = 0;
foreach (IEffectEditorControl ec in controls) {
// as it's a single control for a single parameter, it *should* take the corresponding indexed parameter from the effect.
// so pull that individual parameter out, and give it to the control as a single item. This is a bit of an assumption
// and seems...... prone to breaking. TODO: review.
ec.EffectParameterValues = values[i].AsEnumerable().ToArray();
ec.TargetEffect = effectNode.Effect;
Label l = new Label();
l.Width = 1;
l.Height = 1;
l.Text = _effectNode.Effect.Parameters[i].Name + ":";
l.AutoSize = true;
l.Anchor = AnchorStyles.None;
tableLayoutPanelEffectEditors.Controls.Add(l);
(ec as Control).Anchor = AnchorStyles.None;
tableLayoutPanelEffectEditors.Controls.Add(ec as Control);
// save the editor control into a list we can use as a reference later on, to pull the data back out of them in the right order.
_controls.Add(ec);
i++;
}
} else {
_usedSingleControl = true;
IEffectEditorControl control = controls.First();
control.EffectParameterValues = _effectNode.Effect.ParameterValues;
control.TargetEffect = effectNode.Effect;
tableLayoutPanelEffectEditors.Controls.Add(control as Control);
tableLayoutPanelEffectEditors.SetColumnSpan((control as Control), 2);
_controls.Add(control);
}
}
示例3: TimedSequenceElement
public TimedSequenceElement(EffectNode effectNode)
: base()
{
StartTime = effectNode.StartTime;
Duration = effectNode.TimeSpan;
EffectNode = effectNode;
}
示例4: TimedSequenceElement
public TimedSequenceElement(EffectNode effectNode)
: base()
{
StartTime = effectNode.StartTime;
Duration = effectNode.TimeSpan;
EffectNode = effectNode;
//BorderColor = Color.Black;
//BackColor = Color.FromArgb(0, 0, 0, 0);
}
示例5: _DataListener
protected override bool _DataListener(IEffectNode effectNode)
{
//*** compensation delta, user-configurable
IEffectNode contextRelativeEffectNode = new EffectNode(effectNode.Effect,
effectNode.StartTime + TimingSource.Position);
Sequence.SequenceData.EffectData.AddData(contextRelativeEffectNode);
// We don't want any handlers beyond the executor to get live data.
return true;
}
示例6: GetEmitRotation
public Vector3 GetEmitRotation(EffectNode node)
{
Vector3 ret = Vector3.zero;
//Set Direction:
//NOTICE:SPHERE AND CIRCLE Emitter, default dir is spread from the center. not influenced with the IsRandomDir and VelocityAxis.
if (Layer.EmitType == (int)EMITTYPE.SPHERE)
{
if (!Layer.SyncClient)
{
ret = node.Position - (Layer.ClientTransform.position + Layer.EmitPoint);
}
else
{
ret = node.Position - Layer.EmitPoint;
}
}
else if (Layer.EmitType == (int)EMITTYPE.CIRCLE)
{
Vector3 dir;
if (!Layer.SyncClient)
dir = node.Position - (Layer.ClientTransform.position + Layer.EmitPoint);
else
dir = node.Position - Layer.EmitPoint;
Vector3 target = Vector3.RotateTowards(dir, Layer.CircleDir, (90 - Layer.AngleAroundAxis) * Mathf.Deg2Rad, 1);
Quaternion rot = Quaternion.FromToRotation(dir, target);
ret = rot * dir;
}
else if (Layer.IsRandomDir)
{
//first, rotate y around z 30 degrees
Quaternion rotY = Quaternion.Euler(0, 0, Layer.AngleAroundAxis);
//second, rotate around y 360 random dir;
Quaternion rotAround = Quaternion.Euler(0, Random.Range(0, 360), 0);
//last, rotate the dir to OriVelocityAxis
Quaternion rotTo = Quaternion.FromToRotation(Vector3.up, Layer.OriVelocityAxis);
ret = rotTo * rotAround * rotY * Vector3.up;
}
else
{
ret = Layer.OriVelocityAxis;
}
return ret;
}
示例7: InitAffectors
protected List<Affector> InitAffectors(EffectNode node)
{
List<Affector> AffectorList = new List<Affector>();
if (UVAffectorEnable)
{
UVAnimation uvAnim = new UVAnimation();
if (UVType == 1)
{
float perWidth = OriUVDimensions.x / Cols;
float perHeight = Mathf.Abs(OriUVDimensions.y / Rows);
Vector2 cellSize = new Vector2(perWidth, perHeight);
uvAnim.BuildUVAnim(OriTopLeftUV, cellSize, Cols, Rows, Cols * Rows);
}
UVDimension = uvAnim.UVDimensions[0];
UVTopLeft = uvAnim.frames[0];
if (uvAnim.frames.Length != 1)
{
uvAnim.loopCycles = LoopCircles;
Affector aft = new UVAffector(uvAnim, UVTime, node, RandomStartFrame);
AffectorList.Add(aft);
}
}
else
{
UVDimension = OriUVDimensions;
UVTopLeft = OriTopLeftUV;
}
if (RotAffectorEnable && RotateType != RSTYPE.NONE)
{
Affector aft;
if (RotateType == RSTYPE.CURVE)
aft = new RotateAffector(RotateCurve, node);
else
aft = new RotateAffector(DeltaRot, node);
AffectorList.Add(aft);
}
if (ScaleAffectorEnable && ScaleType != RSTYPE.NONE)
{
Affector aft;
if (UseSameScaleCurve)
ScaleYCurve = ScaleXCurve;
if (ScaleType == RSTYPE.CURVE)
aft = new ScaleAffector(ScaleXCurve, ScaleYCurve, node);
else
aft = new ScaleAffector(DeltaScaleX, DeltaScaleY, node);
AffectorList.Add(aft);
}
if (ColorAffectorEnable /*&& ColorAffectType != 0*/)
{
ColorAffector aft = new ColorAffector(this, node);
AffectorList.Add(aft);
}
if (JetAffectorEnable)
{
Affector aft = new JetAffector(JetMag,JetMagType,JetCurve,node);
AffectorList.Add(aft);
}
if (VortexAffectorEnable)
{
Affector aft;
aft = new VortexAffector(VortexObj, VortexMagType, VortexMag, VortexCurve, VortexDirection, VortexInheritRotation, node);
AffectorList.Add(aft);
}
if (UVRotAffectorEnable)
{
Affector aft;
float xscroll = UVRotXSpeed;
float yscroll = UVRotYSpeed;
if (RandomUVRotateSpeed)
{
xscroll = Random.Range(UVRotXSpeed,UVRotXSpeedMax);
yscroll = Random.Range(UVRotYSpeed,UVRotYSpeedMax);
}
aft = new UVRotAffector(xscroll, yscroll, node);
AffectorList.Add(aft);
}
if (GravityAffectorEnable)
{
Affector aft;
aft = new GravityAffector(GravityObject, GravityAftType, GravityMagType, IsGravityAccelerate,GravityDirection, GravityMag, GravityCurve, node);
AffectorList.Add(aft);
if (GravityAftType == GAFTTYPE.Spherical && GravityObject == null)
{
Debug.LogWarning("Gravity Object is missing, automatically set to effect layer self:" + gameObject.name);
GravityObject = transform;
}
}
if (AirAffectorEnable)
{
//.........这里部分代码省略.........
示例8: Init
protected void Init()
{
//added 2012.6.24
InitCollision();
Owner = transform.parent.gameObject.GetComponent<XffectComponent>();
if (Owner == null)
Debug.LogError("you must set EffectLayer to be XffectComponent's child.");
//fixed 2012.6.2. ignoring the red errors.
if (ClientTransform == null)
{
Debug.LogWarning("effect layer: "+ gameObject.name + " haven't assign a client transform, automaticly set to itself.");
ClientTransform = transform;
}
AvailableENodes = new EffectNode[MaxENodes];
ActiveENodes = new EffectNode[MaxENodes];
for (int i = 0; i < MaxENodes; i++)
{
EffectNode n = new EffectNode(i, ClientTransform, SyncClient, this);
List<Affector> afts = InitAffectors(n);
n.SetAffectorList(afts);
if (RenderType == 0)
n.SetType(SpriteWidth, SpriteHeight, (STYPE)SpriteType, (ORIPOINT)OriPoint, SpriteUVStretch, 60f);
else if (RenderType == 1)
{
float rwidth = RibbonWidth;
float rlen = RibbonLen;
if (UseRandomRibbon)
{
rwidth = Random.Range(RibbonWidthMin, RibbonWidthMax);
rlen = Random.Range(RibbonLenMin, RibbonLenMax);
}
n.SetType(FaceToObject, FaceObject, rwidth, MaxRibbonElements, rlen, ClientTransform.position + EmitPoint, StretchType, 60f);
}
else if (RenderType == 2)
{
n.SetType(ConeSize,ConeSegment,ConeAngle, transform.rotation * OriVelocityAxis,0,60f,UseConeAngleChange,ConeDeltaAngle);
}
else if (RenderType == 3)
{
Vector3 dir = Vector3.zero;
if (OriVelocityAxis == Vector3.zero)
{
OriVelocityAxis = Vector3.up;
}
dir = transform.rotation * OriVelocityAxis;
n.SetType(CMesh,dir,60f);
}
AvailableENodes[i] = n;
}
AvailableNodeCount = MaxENodes;
emitter = new Emitter(this);
}
示例9: RemoveActiveNode
public void RemoveActiveNode(EffectNode node)
{
if (AvailableNodeCount == MaxENodes)
Debug.LogError("out index!");
if (ActiveENodes[node.Index] == null) //already removed
return;
ActiveENodes[node.Index] = null;
AvailableENodes[node.Index] = node;
AvailableNodeCount++;
}
示例10: AddActiveNode
public void AddActiveNode(EffectNode node)
{
if (AvailableNodeCount == 0)
Debug.LogError("out index!");
if (AvailableENodes[node.Index] == null) //already added
return;
ActiveENodes[node.Index] = node;
AvailableENodes[node.Index] = null;
AvailableNodeCount--;
}
示例11: RotateAffector
public RotateAffector(float delta, EffectNode node)
: base(node)
{
Type = RSTYPE.SIMPLE;
Delta = delta;
}
示例12: setupNewElementFromNode
private TimedSequenceElement setupNewElementFromNode(EffectNode node)
{
TimedSequenceElement element = new TimedSequenceElement(node);
element.ContentChanged += ElementContentChangedHandler;
element.TimeChanged += ElementTimeChangedHandler;
return element;
}
示例13: addElementForEffectNodeTPL
/// <summary>
/// Populates the TimelineControl grid with a new TimedSequenceElement for the given EffectNode.
/// Will add a single TimedSequenceElement to in each row that each targeted element of
/// the EffectNode references. It will also add callbacks to event handlers for the element.
/// </summary>
/// <param name="node">The EffectNode to make element(s) in the grid for.</param>
private TimedSequenceElement addElementForEffectNodeTPL(EffectNode node)
{
TimedSequenceElement element = setupNewElementFromNode(node);
// for the effect, make a single element and add it to every row that represents its target elements
node.Effect.TargetNodes.AsParallel().WithCancellation(cancellationTokenSource.Token)
.ForAll(target =>
{
if (_elementNodeToRows.ContainsKey(target))
{
// Add the element to each row that represents the element this command is in.
foreach (Row row in _elementNodeToRows[target])
{
if (!_effectNodeToElement.ContainsKey(node))
{
_effectNodeToElement[node] = element;
}
row.AddElement(element);
}
}
else
{
// we don't have a row for the element this effect is referencing; most likely, the row has
// been deleted, or we're opening someone else's sequence, etc. Big fat TODO: here for that, then.
// dunno what we want to do: prompt to add new elements for them? map them to others? etc.
const string message = "No Timeline.Row is associated with a target ElementNode for this EffectNode. It now exists in the sequence, but not in the GUI.";
Logging.Error(message);
MessageBox.Show(message);
}
});
TimelineControl.grid.RenderElement(element);
return element;
}
示例14: RemoveEffectNodeAndElement
public void RemoveEffectNodeAndElement(EffectNode node)
{
//Debug.WriteLine("{0} RemoveEffectNodeAndElement(InstanceId={1})", (int)DateTime.Now.TimeOfDay.TotalMilliseconds, node.Effect.InstanceId);
// Lookup this effect node's Timeline Element
TimedSequenceElement tse = (TimedSequenceElement)_effectNodeToElement[node];
foreach (Row row in TimelineControl) // Remove the element from all rows
row.RemoveElement(tse);
// TODO: Unnecessary?
tse.ContentChanged -= ElementContentChangedHandler; // Unregister event handlers
tse.TimeChanged -= ElementTimeChangedHandler;
_effectNodeToElement.Remove(node); // Remove the effect node from the map
_sequence.RemoveData(node); // Remove the effect node from sequence
}
示例15: LinearForceAffector
public LinearForceAffector(Vector3 force, EffectNode node)
: base(node)
{
Force = force;
}