Esempio n. 1
0
        static partial void Init(ref ME.ECS.StructComponentsContainer structComponentsContainer)
        {
            WorldUtilities.ResetTypeIds();

            CoreComponentsInitializer.InitTypeId();


            WorldUtilities.InitComponentTypeId <Example.Features.Logic.DestroyByTime.Components.DestroyByTime>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.Logic.ForceAtPoint.Components.AddForce>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.Logic.ForceAtPoint.Components.Force>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.Map.Components.IsMap>(true, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerFire.Components.BulletFly>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerFire.Components.FireAction>(true, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerFire.Components.IsBullet>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerMovement.Components.LastMovementDirection>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerMovement.Components.MoveAction>(false, false, false, false, false);
            WorldUtilities.InitComponentTypeId <Example.Features.Players.Components.IsPlayer>(true, false, false, false, false);

            ComponentsInitializerWorld.Setup(ComponentsInitializerWorldGen.Init);
            CoreComponentsInitializer.Init(ref structComponentsContainer);


            structComponentsContainer.Validate <Example.Features.Logic.DestroyByTime.Components.DestroyByTime>(false);
            structComponentsContainer.Validate <Example.Features.Logic.ForceAtPoint.Components.AddForce>(false);
            structComponentsContainer.Validate <Example.Features.Logic.ForceAtPoint.Components.Force>(false);
            structComponentsContainer.Validate <Example.Features.Map.Components.IsMap>(true);
            structComponentsContainer.Validate <Example.Features.PlayerFire.Components.BulletFly>(false);
            structComponentsContainer.Validate <Example.Features.PlayerFire.Components.FireAction>(true);
            structComponentsContainer.Validate <Example.Features.PlayerFire.Components.IsBullet>(false);
            structComponentsContainer.Validate <Example.Features.PlayerMovement.Components.LastMovementDirection>(false);
            structComponentsContainer.Validate <Example.Features.PlayerMovement.Components.MoveAction>(false);
            structComponentsContainer.Validate <Example.Features.Players.Components.IsPlayer>(true);
        }
Esempio n. 2
0
        public static void Do(
            System.Action <World> setupWorld   = null,
            System.Action <World> initSystems  = null,
            System.Action <World> beforeUpdate = null,
            System.Action <World> afterUpdate  = null,
            int from = 0,
            int to   = 2)
        {
            WorldUtilities.ResetTypeIds();

            ME.ECS.Pools.current = new ME.ECS.PoolImplementation(isNull: false);
            World world = null;

            WorldUtilities.CreateWorld <EmptyState>(ref world, 0.033f);
            {
                world.AddModule <EmptyStatesHistoryModule>();
                world.AddModule <EmptyNetworkModule>();
                world.SetState <EmptyState>(WorldUtilities.CreateState <EmptyState>());
                world.SetSeed(1u);
                {
                    ref var str = ref world.GetStructComponents();
                    CoreComponentsInitializer.InitTypeId();
                    CoreComponentsInitializer.Init(ref str);
                    setupWorld?.Invoke(world);
                }

                initSystems?.Invoke(world);
            }
        static partial void InitTypeIdPartial()
        {
            WorldUtilities.ResetTypeIds();
            CoreComponentsInitializer.InitTypeId();


            WorldUtilities.InitComponentTypeId <Example.Features.Players.Components.IsPlayer>(true);
            WorldUtilities.InitComponentTypeId <Example.Features.Map.Components.IsMap>(true);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerMovement.Components.LastMovementDirection>(false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerMovement.Components.MoveAction>(false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerFire.Components.FireAction>(true);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerFire.Components.IsBullet>(false);
            WorldUtilities.InitComponentTypeId <Example.Features.PlayerFire.Components.BulletFly>(false);
            WorldUtilities.InitComponentTypeId <Example.Features.Logic.ForceAtPoint.Components.AddForce>(false);
            WorldUtilities.InitComponentTypeId <Example.Features.Logic.ForceAtPoint.Components.Force>(false);
            WorldUtilities.InitComponentTypeId <Example.Features.Logic.DestroyByTime.Components.DestroyByTime>(false);
        }
Esempio n. 4
0
        public void WorldSerialization()
        {
            World CreateWorld()
            {
                World world = null;

                WorldUtilities.CreateWorld <TestState>(ref world, 0.033f);
                {
                    world.AddModule <TestStatesHistoryModule>();
                    world.AddModule <FakeNetworkModule>();

                    world.SetState <TestState>(WorldUtilities.CreateState <TestState>());

                    //components
                    {
                        ref var sc = ref world.GetStructComponents();
                        ComponentsInitializerWorld.Setup(e => e.ValidateData <TestStructComponent>());
                        CoreComponentsInitializer.Init(ref sc);
                        sc.Validate <TestStructComponent>();
                    }
                    //settings
                    {
                        world.SetSettings(new WorldSettings {
                            useJobsForSystems = false,
                            useJobsForViews   = false,
                            turnOffViews      = false,
                            viewsSettings     = new WorldViewsSettings()
                        });
                        world.SetDebugSettings(WorldDebugSettings.Default);
                    }

                    var group = new SystemGroup(world, "GroupName");
                    group.AddSystem <TestSystem>();
                }

                var ent = new Entity("Test Entity");

                ent.SetPosition(UnityEngine.Vector3.zero);
                ent.SetData(new TestStructComponent());

                world.SaveResetState <TestState>();

                return(world);
            }