本文整理汇总了C#中Sprite.Center方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Center方法的具体用法?C# Sprite.Center怎么用?C# Sprite.Center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.Center方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public override void Setup(float startTime)
{
background = FullScreenQuad.create(this, "bg");
title = Sprite.create(this, new[] {"tmo1", "tmo2", "tmo3", "tmo4", "tmo5", "tmo6"});
subtitle = Sprite.create(this, new[] {"p1", "p2", "p3", "p4", "p5", "p6"});
news = Sprite.create(this, new[] {"news1", "news2"});
buyMusic = Sprite.create(this, new[] {"itunes1", "itunes2"});
startButton = Sprite.create(this, new[] {"tap1", "tap2", "tap3"});
Camera cam = Camera.main;
var layoutpos = cam.ViewportToWorldPoint(new Vector3(0.5f, 0.65f, 0.0f));
layoutpos -= title.Center();
// Programmer needs swizzling, badly.
title.transform.position = new Vector3(layoutpos.x, layoutpos.y, title.transform.position.z);
// Anchor the subtitle an absolute distance from wherever the title ended up
subtitle.transform.position = title.transform.position + title.Center() + new Vector3(15f, -20f, -1f);
// add blinking start text below title but don't display it yet
startButton.setCenterToViewportCoord(0.5f, 0.4f);
startButton.visible(false);
// place buttons in the bottom corners
news.setScreenPosition(4, 4);
buyMusic.setScreenPosition((int) Screen.width - buyMusic.PixelWidth() - 4, 4);
// animate title
cycle_title = new Cycler(0.4f, 5);
cycle_title.AddSprite(title);
cycle_title.AddSprite(subtitle);
}
示例2: Setup
public override void Setup(float startTime)
{
background = spriteRenderer.add(new FullScreenQuad(), this.GetType(), new[] {"bg"});
title = spriteRenderer.add(new Sprite(), this.GetType(), new[] {"tmo1", "tmo2", "tmo3", "tmo4", "tmo5", "tmo6"});
subtitle = spriteRenderer.add(new Sprite(), this.GetType(), new[] {"p1", "p2", "p3", "p4", "p5", "p6"});
news = spriteRenderer.add(new Sprite(), this.GetType(), new[] {"news1", "news2"});
buyMusic = spriteRenderer.add(new Sprite(), this.GetType(), new[] {"itunes1", "itunes2"});
startButton = spriteRenderer.add(new Sprite(), this.GetType(), new[] {"tap1", "tap2", "tap3"});
Camera camera = Camera.main;
var layoutpos = camera.ViewportToWorldPoint(new Vector3(0.5f, 0.65f, 0));
layoutpos -= new Vector3(title.Center(), 0);
title.worldPosition = new Vector3(layoutpos.X, layoutpos.Y, title.worldPosition.Z);
// Anchor the subtitle an absolute distance from wherever the title ended up
subtitle.worldPosition = title.worldPosition + new Vector3(title.Center() , 0) + new Vector3(16f, 24f, -1f);
// add blinking start text below title but don't display it yet
startButton.setCenterToViewportCoord(0.5f, 0.4f);
startButton.visible(false);
// place buttons in the bottom corners
news.screenPosition = new Vector3(4, camera.pixelHeight - news.height - 4, 0);
buyMusic.screenPosition = new Vector3(camera.pixelWidth - buyMusic.PixelWidth() - 4, camera.pixelHeight - buyMusic.height - 4, 0);
// animate title
cycle_title = new Cycler(0.4f, 5);
cycle_title.AddSprite(title);
cycle_title.AddSprite(subtitle);
}