コード例 #1
0
ファイル: LogicComponent.cs プロジェクト: Zamir7/urho
        public override void OnSceneSet(Scene scene)
        {
            if (scene != null)
            {
                if (ReceiveFixedUpdates)
                {
                    var physicsWorld = scene.GetComponent<PhysicsWorld>();
                    if (physicsWorld == null)
                        throw new InvalidOperationException("Scene must have PhysicsWorld component in order to receive FixedUpdates");
                    physicsPreStepSubscription = physicsWorld.SubscribeToPhysicsPreStep(OnFixedUpdate);
                }

                if (ReceiveFixedPostUpdates)
                {
                    var physicsWorld = scene.GetComponent<PhysicsWorld>();
                    if (physicsWorld == null)
                        throw new InvalidOperationException("Scene must have PhysicsWorld component in order to receive FixedUpdates");
                    physicsPostStepSubscription = physicsWorld.SubscribeToPhysicsPostStep(OnFixedPostUpdate);
                }

                if (ReceivePostUpdates)
                {
                    scenePostUpdateSubscription = scene.SubscribeToScenePostUpdate(OnPostUpdate);
                }
            }
            else
            {
                physicsPreStepSubscription?.Unsubscribe();
                physicsPostStepSubscription?.Unsubscribe();
                scenePostUpdateSubscription?.Unsubscribe();
            }
        }
コード例 #2
0
ファイル: MonoDebugHud.cs プロジェクト: Zamir7/urho
        public void Hide()
        {
            if (text == null)
                return;

            subscription.Unsubscribe();
            application.UI.Root.RemoveChild(text, 0);

            text = null;
            subscription = null;
        }
コード例 #3
0
ファイル: MonoDebugHud.cs プロジェクト: Zamir7/urho
        public void Show(Color color, int fontSize = 18)
        {
            if (text != null)
                return;

            text = new Text();
            text.SetColor(color);
            text.VerticalAlignment = VerticalAlignment.Top;
            text.HorizontalAlignment = HorizontalAlignment.Right;
            text.TextAlignment = HorizontalAlignment.Right;
            text.SetFont(CoreAssets.Fonts.AnonymousPro, fontSize);

            application.UI.Root.AddChild(text);
            subscription = application.Engine.SubscribeToPostUpdate(OnPostUpdate);
        }
コード例 #4
0
ファイル: MonoDebugHud.cs プロジェクト: corefan/urho
		public void Show()
		{
			if (text != null)
				return;

			var ui = application.UI;
			var root = ui.Root;
			var cache = application.ResourceCache;

			text = new Text();
			text.VerticalAlignment = VerticalAlignment.Top;
			text.HorizontalAlignment = HorizontalAlignment.Right;
			text.TextAlignment = HorizontalAlignment.Right;
			text.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 18);

			root.AddChild(text);
			subscription = application.Engine.SubscribeToPostUpdate(OnPostUpdate);
		}