Share Triangles logic.

This commit is contained in:
Dean Herbert 2016-11-04 16:11:22 +09:00
parent 108b7092c9
commit b17d219ace
1 changed files with 24 additions and 57 deletions

View File

@ -255,39 +255,6 @@ public ExplodeLayer()
}
};
}
class Triangles : Container
{
private Texture tex;
protected override void Load(BaseGame game)
{
base.Load(game);
tex = game.Textures.Get(@"Play/osu/triangle@2x");
for (int i = 0; i < 10; i++)
{
Add(new Sprite
{
Texture = tex,
Origin = Anchor.Centre,
Position = new Vector2(RNG.NextSingle(), RNG.NextSingle()),
RelativePositionAxes = Axes.Both,
Scale = new Vector2(RNG.NextSingle() * 0.4f + 0.2f),
Alpha = RNG.NextSingle() * 0.3f
});
}
}
protected override void Update()
{
base.Update();
foreach (Framework.Graphics.Drawable d in Children)
d.Position -= new Vector2(0, (float)(d.Scale.X * (Clock.ElapsedFrameTime / 2880)));
}
}
}
class CircleLayer : Container
@ -333,38 +300,38 @@ protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
Hit?.Invoke();
return true;
}
}
class Triangles : Container
class Triangles : Container
{
private Texture tex;
protected override void Load(BaseGame game)
{
private Texture tex;
base.Load(game);
protected override void Load(BaseGame game)
tex = game.Textures.Get(@"Play/osu/triangle@2x");
for (int i = 0; i < 10; i++)
{
base.Load(game);
tex = game.Textures.Get(@"Play/osu/triangle@2x");
for (int i = 0; i < 10; i++)
Add(new Sprite
{
Add(new Sprite
{
Texture = tex,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Both,
Position = new Vector2(RNG.NextSingle(), RNG.NextSingle()),
Scale = new Vector2(RNG.NextSingle() * 0.4f + 0.2f),
Alpha = RNG.NextSingle() * 0.3f
});
}
Texture = tex,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Both,
Position = new Vector2(RNG.NextSingle(), RNG.NextSingle()),
Scale = new Vector2(RNG.NextSingle() * 0.4f + 0.2f),
Alpha = RNG.NextSingle() * 0.3f
});
}
}
protected override void Update()
{
base.Update();
protected override void Update()
{
base.Update();
foreach (Framework.Graphics.Drawable d in Children)
d.Position -= new Vector2(0, (float)(d.Scale.X * (Clock.ElapsedFrameTime / 2880)));
}
foreach (Framework.Graphics.Drawable d in Children)
d.Position -= new Vector2(0, (float)(d.Scale.X * (Clock.ElapsedFrameTime / 2880)));
}
}
}