示例#1
0
        public void Update()
        {
            if (!enabled)
            {
                return;
            }

            var p = GraphicsManager.WorldToScreenPoint(FollowGameObject.Transform.Position) - new Vector2(30, 150);

            UIManagerSpriteRenderer.EnsureTypeExists(UIManagerSpriteRenderer.TextType.NORMAL);
            UIManagerSpriteRenderer.TextRenderers[UIManagerSpriteRenderer.TextType.NORMAL]
            .DrawString(FollowGameObject.Name, p, new Color4(Color.AliceBlue));
        }
示例#2
0
        public void Update()
        {
            if ((int)watch.Elapsed.TotalSeconds >= time || watch.IsRunning == false)
            {
                watch.Stop();
                if (playedSound != 0)
                {
                    AudioManager.PlayAudio(audioSrc, Constants.CountdownGo);
                    playedSound = 0;
                }
                return;
            }
            UIManagerSpriteRenderer.DrawText((time - watch.Elapsed.Seconds).ToString(), UIManagerSpriteRenderer.TextType.SIZE300FONT, new RectangleF(0, 0, Screen.Width, Screen.Height), TextAlignment.HorizontalCenter | TextAlignment.VerticalCenter, Color.AliceBlue, 200);

            int countleft = time - watch.Elapsed.Seconds;

            if (countleft > 0 && playedSound != countleft)
            {
                Console.WriteLine(countleft);
                switch (countleft)
                {
                case 3:
                    AudioManager.PlayAudio(audioSrc, Constants.CountdownThree);
                    break;

                case 2:
                    AudioManager.PlayAudio(audioSrc, Constants.CountdownTwo);
                    break;

                case 1:
                    AudioManager.PlayAudio(audioSrc, Constants.CountdownOne);
                    break;

                default:
                    break;
                }

                playedSound = countleft;
            }
        }
示例#3
0
文件: UI.cs 项目: anikan/LeafMeAlone
 /// <summary>
 /// Texture UI.
 /// </summary>
 /// <param name="texture"></param>
 /// <param name="pos"></param>
 /// <param name="size"></param>
 /// <param name="rotationAngle"></param>
 public UI(string texture, Vector2 pos, Vector2 size, double rotationAngle)
 {
     UITexture = UIManagerSpriteRenderer.DrawTextureContinuous(texture, pos, size, rotationAngle);
 }
示例#4
0
文件: UI.cs 项目: anikan/LeafMeAlone
 /// <summary>
 /// Text UI.
 /// </summary>
 public UI(string text, UIManagerSpriteRenderer.TextType type, RectangleF offset, SpriteTextRenderer.TextAlignment alignment, Color color)
 {
     UIText = UIManagerSpriteRenderer.DrawTextContinuous(text, type, offset, alignment, color);
 }