当前位置: 首页>>代码示例>>C#>>正文


C# EntityWorld.CreateCircle方法代码示例

本文整理汇总了C#中Artemis.EntityWorld.CreateCircle方法的典型用法代码示例。如果您正苦于以下问题:C# EntityWorld.CreateCircle方法的具体用法?C# EntityWorld.CreateCircle怎么用?C# EntityWorld.CreateCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Artemis.EntityWorld的用法示例。


在下文中一共展示了EntityWorld.CreateCircle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        internal void Initialize(D3D11Host host)
        {
            if (IsInitialized) return;
            IsInitialized = true;

            Services = new GameServiceContainer();

            ServiceLocator.Initialize(Services);
            _host = host;

            Artemis.System.EntitySystem.BlackBoard.SetEntry("GraphicsDevice", _host.GraphicsDevice);
            Artemis.System.EntitySystem.BlackBoard.SetEntry("ServiceProvider", Services);

            Services.AddService<IGraphicsDeviceService>(host);
            Services.AddService(host.GraphicsDevice);

            _mouse = new MouseService(host);
            Services.AddService<IMouseService>(_mouse);
            _mouse.ButtonDown += OnMouseButtonDown;
            _keyboard = new KeyboardService(host);
            Services.AddService<IKeyboardService>(_keyboard);
            _timer = new TimerService();
            Services.AddService<ITimerService>(_timer);
            Services.AddService(new FastSpriteBatch(host.GraphicsDevice));

            _timer.LastFrameUpdateTime = _gameTime;
            _timer.LastFrameRenderTime = _gameTime;

            SpriteBatch = new SpriteBatch(host.GraphicsDevice);
            Services.AddService(SpriteBatch);

            Content = new ContentManager(Services);
            Content.RootDirectory = Environment.CurrentDirectory;

            SpriteManager = new SpriteManagerService(Content);
            Services.AddService<ISpriteManagerService>(SpriteManager);

            //LoadHullSprites("textures/hulls.json");

            Artemis.System.EntitySystem.BlackBoard.SetEntry("ContentManager", Content);

            World = new EntityWorld(false, false, false);

            World.CreateComponentPool<Transform>(200, 200);

            _gridSystem = new GridRendererSystem();
            _gridSystem.IsEnabled = false;
            World.SystemManager.SetSystem(_gridSystem, Artemis.Manager.GameLoopType.Draw, 1);
            //World.SystemManager.SetSystem(new ShipRendererSystem(), Artemis.Manager.GameLoopType.Draw, 2);
            World.SystemManager.SetSystem(new SceneGraphRendererSystem<StandardShipModelRenderer>(new StandardShipModelRenderer()), Artemis.Manager.GameLoopType.Draw, 3);
            World.SystemManager.SetSystem(new BoundingBoxRendererSystem(), Artemis.Manager.GameLoopType.Draw, 4);
            World.SystemManager.SetSystem(new GenericDrawableRendererSystem(), Artemis.Manager.GameLoopType.Draw, 5);
            _hardpointRendererSystem = new HardpointRendererSystem();
            _hardpointRendererSystem.IsEnabled = false;
            World.SystemManager.SetSystem(_hardpointRendererSystem, Artemis.Manager.GameLoopType.Draw, 6);

            World.SystemManager.SetSystem(new CameraControlSystem(), Artemis.Manager.GameLoopType.Update, 1);
            _transformSystem = new MouseControlledTransformSystem();
            World.SystemManager.SetSystem(_transformSystem, Artemis.Manager.GameLoopType.Update, 2);
            World.SystemManager.SetSystem(new ShipUpdateSystem(), Artemis.Manager.GameLoopType.Update, 3);
            World.SystemManager.SetSystem(new BoundingBoxSelectionSystem(), Artemis.Manager.GameLoopType.Update, 4);
            World.SystemManager.SetSystem(new ShowThrusterTrailsOverrideSystem(), Artemis.Manager.GameLoopType.Update, 5);

            World.InitializeAll();

            CameraEntity = World.CreateCamera(Constants.ActiveCameraTag, _host.GraphicsDevice);
            CameraEntity.Tag = Constants.ActiveCameraTag;
            Camera = CameraEntity.GetComponent<Camera>();

            GridEntity = World.CreateGrid(new Vector2(50, 50), GridColor);

            World.CreateCircle(Vector2.Zero, 10, 8, XnaColor.Red * 0.4f);

            host.PreviewKeyDown += HandleKeyboardInput;

            EditorService = new ShipEditorService(_mouse, World);
            CreateNewShipModelCommand.Execute(null);
            EditorService.SelectedPartEntities.CollectionChanged += (o, e) =>
            {
                if (e.NewItems != null && e.NewItems.Count > 0) {
                    var color = e.NewItems.Cast<Entity>().First().GetComponent<IShipPartComponent>().Part.Color;
                    _selectedColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedColor)));
                }
            };

            
            _mouse.WheelChanged += OnWheelChanged;
            IsHardpointsVisible = false;
            LoadHullSprites("textures/hulls.json");
            IsGridVisible = true;
        }
开发者ID:raycrasher,项目名称:Fell-Sky,代码行数:92,代码来源:ShipEditorViewModel.cs


注:本文中的Artemis.EntityWorld.CreateCircle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。