本文整理汇总了C#中Sequence.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Sequence.Add方法的具体用法?C# Sequence.Add怎么用?C# Sequence.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: flipRaining
public void flipRaining()
{
if(isRaining){
//Support.SoundSystem.Instance.Play("rain.wav");
var rainsprite = Support.TiledSpriteFromFile("/Application/assets/rain_Sheet.png", 9, 1);
var raincountX = Camera.CalcBounds().Max.X/rainsprite.Quad.X.X;
var raincountY = Camera.CalcBounds().Max.Y/rainsprite.Quad.Y.Y;
var currentPos = new Vector2(0, 20);
for(var i = 0; i < raincountY; i++){
for(int j = 0; j < raincountX; j++){
rainsprite = Support.TiledSpriteFromFile("/Application/assets/rain_Sheet.png", 9, 1);
rainsprite.CenterSprite();
rainsprite.Position = currentPos;
rainsprite.VertexZ = 1;
this.AddChild(rainsprite,1);
rain.Add(rainsprite);
var RainAnimation = new Support.AnimationAction(rainsprite, 9, 1, 1.0f, looping: true);
var Wait = new DelayTime((float)rng.NextDouble() * 2);
var seq = new Sequence();
seq.Add(Wait);
seq.Add(RainAnimation);
rainsprite.RunAction(seq);
currentPos += new Vector2(rainsprite.Quad.X.X, 0);
}
currentPos = new Vector2(0, currentPos.Y + rainsprite.Quad.Y.Y);
}
} else {
for(int i = 0; i < rain.Count; i++){
GameScene.Instance.RemoveChild(rain[i], true);
}
rain.Clear();
}
}
示例2: SequenceTestSerialize
public void SequenceTestSerialize()
{
Sequence<int> before = new Sequence<int>(3);
before.AddRange( new[] {1,2});
before.Add(3);
before.Add(4);
Assert.Equal(4, before[0]);
Assert.Equal(3, before[1]);
Assert.Equal(2, before[2]);
Assert.Equal(3, before.Capacity);
Assert.Equal(4, before.CountOfAllObservedItems);
//JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
//serializerSettings.Converters.Add(new SequenceConverter());
string serialized = JsonConvert.SerializeObject(before);
Sequence<int> after = JsonConvert.DeserializeObject<Sequence<int>>(serialized);
Assert.Equal(4, after[0]);
Assert.Equal(3, after[1]);
Assert.Equal(2,after[2]);
Assert.Equal(3, after.Capacity);
Assert.Equal(4, after.CountOfAllObservedItems);
Assert.Equal(before, after);
}
示例3: checkCellWin
public Boolean checkCellWin(Cell c)
{
Sequence seq;
if (c.type == goalMutation){
//Support.SoundSystem.Instance.Play("blip.wav");
goalSprite.Visible = false;
var right = Support.TiledSpriteFromFile("/Application/assets/display_GOOD.png", 1, 1);
GameScene.Instance.AddChild(right);
right.CenterSprite();
right.Quad.S = right.TextureInfo.TextureSizef/2;
right.Position = goalSprite.Position;
right.VertexZ = 1;
seq = new Sequence();
seq.Add(new DelayTime(2));
seq.Add(new CallFunc(() => { GameScene.Instance.RemoveChild(right, true); goalSprite.Visible = true;}));
GameScene.Instance.RunAction(seq);
return true;
}
//Support.SoundSystem.Instance.Play("blip.wav");
goalSprite.Visible = false;
var wrong = Support.TiledSpriteFromFile("/Application/assets/display_BAD.png", 1, 1);
wrong.CenterSprite();
wrong.Quad.S = wrong.TextureInfo.TextureSizef/2;
wrong.Position = goalSprite.Position;
wrong.VertexZ = 1;
GameScene.Instance.AddChild(wrong);
seq = new Sequence();
seq.Add(new DelayTime(2));
seq.Add(new CallFunc(() => { GameScene.Instance.RemoveChild(wrong, true); goalSprite.Visible = true;;}));
GameScene.Instance.RunAction(seq);
return false;
}
示例4: OnMoveComplete
// METHODS -----------------------------------------------------------------------------------------
public void OnMoveComplete()
{
Sequence sequence = new Sequence();
sequence.Add( new DelayTime( GameScene.Random.NextFloat() * 1.0f ) );
sequence.Add( new MoveTo( BASE + GameScene.Random.NextFloat() * RANGE, 1.0f + 1.0f * GameScene.Random.NextFloat() ) );
sequence.Add( new CallFunc( () => { OnMoveComplete(); } ) );
this.RunAction( sequence );
}
示例5: Disappear
/// <summary>
/// スプライトを見えなくし、一定時間後元に戻すエフェクト
/// </summary>
/// <param name='sprite'>
/// Sprite.
/// </param>
public static void Disappear(SpriteUV sprite)
{
Global.characterActive = false;
var seq = new Sequence();
seq.Add(new CallFunc(()=>Disappear1(sprite)));
seq.Add(new CallFunc(()=>{sprite.Visible = false;}));
seq.Add(new MoveBy(new Vector2(0,0),2));
seq.Add(new CallFunc(()=>Appear(sprite)));
sprite.RunAction(seq);
}
示例6: testClone
public void testClone() {
var sequence = new Sequence();
sequence.Add("a", 10);
sequence.Add("b", 20);
var copy = sequence.Clone() as Sequence;
Assert.NotNull(copy);
Assert.True(sequence.Outcomes.SequenceEqual(copy.Outcomes));
Assert.True(sequence.Probabilities.SequenceEqual(copy.Probabilities));
Assert.True(sequence.CompareTo(copy) == 0);
}
示例7: BeAddedToGroup
public override AbstractCrystallonEntity BeAddedToGroup(GroupCrystallonEntity pGroup)
{
pGroup.Attach( this );
if (pGroup is SelectionGroup) {
getNode().StopActionByTag(20);
Sequence sequence = new Sequence() { Tag = 20 };
sequence.Add( new DelayTime( 3.0f ) );
sequence.Add( new CallFunc( () => {
playSound();
} ) );
getNode().RunAction(sequence);
}
return this;
}
示例8: Create
private Sequence<InstructionNode> Create(IEnumerator<XamlInstruction> stream)
{
var nodes = new Sequence<InstructionNode>();
while (IsLeading(stream.Current))
{
var currentNode = new InstructionNode { Leading = stream.Current };
var continueWorking = true;
while (stream.MoveNext() && continueWorking)
{
if (IsLeading(stream.Current))
{
currentNode.Children = Create(stream);
}
var xamlNode = stream.Current;
if (IsTrailing(xamlNode))
{
continueWorking = false;
currentNode.Trailing = stream.Current;
}
else
{
currentNode.Body.Add(stream.Current);
}
}
nodes.Add(currentNode);
}
return nodes;
}
示例9: testAddMethod
public void testAddMethod() {
var sequence = new Sequence();
sequence.Add("a", 10d);
Assert.AreEqual("a", sequence.Outcomes[0]);
Assert.AreEqual(10d, sequence.Probabilities[0]);
}
示例10: EnemySlime
public EnemySlime()
{
Sprite = Support.TiledSpriteFromFile("/Application/assets/slime_green_frames.png", 4, 4);
IdleAnimation = new Support.AnimationAction(Sprite, 0, 8, 0.5f, looping: true);
JumpInAnimation = new Support.AnimationAction(Sprite, 8, 12, 0.3f, looping: false);
JumpMidAnimation = new Support.AnimationAction(Sprite, 12, 13, 1.0f, looping: false);
JumpOutAnimation = new Support.AnimationAction(Sprite, 13, 16, 0.2f, looping: false);
JumpAnimationSequence = new Sequence();
JumpAnimationSequence.Add(JumpInAnimation);
JumpAnimationSequence.Add(new CallFunc(this.Jump));
JumpAnimationSequence.Add(JumpMidAnimation);
JumpAnimationSequence.Add(new DelayTime() { Duration = 0.40f });
JumpAnimationSequence.Add(JumpOutAnimation);
JumpAnimationSequence.Add(new DelayTime() { Duration = 0.05f });
JumpAnimationSequence.Add(IdleAnimation);
this.AddChild(Sprite);
Sprite.RunAction(IdleAnimation);
// CollisionDatas.Add(new EntityCollider.CollisionEntry() {
// type = EntityCollider.CollisionEntityType.Enemy,
// owner = this,
// collider = Sprite,
// center = () => GetCollisionCenter(Sprite) + new Vector2(0.0f, -8.0f),
// radius = () => 24.0f,
// });
//
// GroundFriction = new Vector2(0.85f);
Health = 2.0f;
MoveDelay = 3.0f;
}
示例11: TestGunshotTrack
private static void TestGunshotTrack(Sequence sequence)
{
var track = new Track();
track.Insert(0, new ChannelMessage(ChannelCommand.ProgramChange, 1, 127));
track.Insert(0, new ChannelMessage(ChannelCommand.NoteOn, 1, 35, 127));
track.Insert(100, new ChannelMessage(ChannelCommand.NoteOff, 1, 35, 0));
track.Insert(101, new ChannelMessage(ChannelCommand.NoteOn, 1, 76, 127));
track.Insert(200, new ChannelMessage(ChannelCommand.NoteOff, 1, 76, 0));
sequence.Add(track);
}
示例12: ScorePopup
// protected Label inside;
public ScorePopup(Node pParent, int pPoints)
: base(pPoints.ToString(), map)
{
parent = pParent;
if (pPoints < 10) {
offset = DoubleDigitOffset;
} else {
offset = SingleDigitOffset;
}
// velocity = Vector2.Zero;
Position = parent.LocalToWorld(parent.Position) + offset;
// this.RegisterPalette(0);
Color = Support.ExtractColor("333330");
Pivot = new Vector2(0.5f, 0.5f);
// HeightScale = 1.0f;
// inside = new Label() {
// Text = pPoints.ToString(),
// FontMap = map,
// Pivot = Vector2.One/2.0f,
//// Position = Vector2.One
//// Scale = new Vector2(0.9f, 0.9f)
// };
// inside.Color = LevelManager.Instance.BackgroundColor;
// this.AddChild(inside);
Sequence sequence = new Sequence();
sequence.Add( new DelayTime( 0.1f ) );
GameScene.Layers[2].AddChild(this);
sequence.Add( new CallFunc( () => {
Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);
} ) );
this.RunAction(sequence);
#if DEBUG
Console.WriteLine (GetType().ToString() + " created" );
#endif
}
示例13: ScorePanel
public ScorePanel( ICrystallonEntity pEntity, int pPoints )
{
InitializeWidget();
ScoreLabel = new Sce.PlayStation.HighLevel.GameEngine2D.Label() {
Text = pPoints.ToString()
};
var font = new Font("Application/assets/fonts/Bariol_Regular.otf", 25, FontStyle.Regular);
var map = new FontMap(font);
ScoreLabel.FontMap = map;
ScoreLabel.Position = new Vector2(-4.0f, 10.0f);
ScoreLabel.Color = Colors.White;
ScoreLabel.HeightScale = 1.0f;
ScoreLabel.Pivot = new Vector2(0.5f, 0.5f);
Sequence sequence = new Sequence();
sequence.Add( new DelayTime( 0.5f ) );
sequence.Add ( new CallFunc( () => { pEntity.getNode().Parent.AddChild(ScoreLabel); } ) );
// ScoreText.Font = FontManager.Instance.Get ("Bariol", 20, "Bold");
// ScoreText.Text = pPoints.ToString();
// ScoreText.Alpha = 0.0f;
// _scoreTexture = new Texture2D((int)ScoreText.Width, (int)ScoreText.Height, false, PixelFormat.Rgba);
// ScoreText.RenderToTexture(_scoreTexture);
// _scoreTextureInfo = new TextureInfo(_scoreTexture);
// _scoreSprite = new SpriteUV(_scoreTextureInfo);
// _scoreSprite.Pivot = new Vector2(0.5f, 0.5f);
// pEntity.getNode().AddChild(_scoreSprite);
// _scoreSprite.Position = new Vector2(0.0f, 20.0f);
// Vector2 v = ConvertScreenToLocal( pPosition );
// this.SetPosition( v.X - ScoreText.Width/2, Director.Instance.GL.Context.GetViewport().Height - (v.Y + 40) );
// Sequence sequence = new Sequence();
// sequence.Add( new DelayTime( 3.0f ) );
// sequence.Add ( new CallFunc( () => {
// ScoreText.Visible = false;
// this.Dispose();
// } ) );
Director.Instance.CurrentScene.RunAction(sequence);
}
示例14: Main
public static void Main(String[] args)
{
Sequence<int> sequence = new Sequence<int>(10);
for(int i = 0; i < 10; i++)
{
sequence.Add(i);
}
ISelector selector = sequence.Selector();
while(!selector.End())
{
Console.WriteLine(selector.Current());
selector.Next();
}
}
示例15: Flash
// METHODS ----------------------------------------------
public void Flash()
{
Sequence sequence = new Sequence();
sequence.Add( new CallFunc( () => TintTo( QColor.palette[1], 0.08f, false) ) );
sequence.Add( new DelayTime(0.08f) );
sequence.Add( new CallFunc( () => TintTo( QColor.palette[2], 0.08f, false) ) );
sequence.Add( new DelayTime(0.08f) );
sequence.Add( new CallFunc( () => TintTo( QColor.palette[0], 0.08f, false) ) );
sequence.Add( new DelayTime(0.08f) );
this.getNode().RunAction( new RepeatForever() { InnerAction=sequence, Tag = 40 } );
}