Exemple #1
0
            public override void HandleClick()
            {
                WorldSetup setupToSend = new WorldSetup();

                World_AIW2.Instance.Setup.CopyTo(setupToSend);
                setupToSend.Seed = Engine_Universal.PermanentQualityRandom.Next(1, 999999999);
                GameCommand command = GameCommand.Create(GameCommandType.SetupOnly_ChangeSetup);

                command.RelatedSetup = setupToSend;
                World_AIW2.Instance.QueueGameCommand(command);
            }
Exemple #2
0
            public override void HandleSelectionChanged(IArcenUI_Dropdown_Option Item)
            {
                if (Item == null)
                {
                    return;
                }
                MapTypeData ItemAsType = (MapTypeData)Item.GetItem();

                WorldSetup setupToSend = new WorldSetup();

                World_AIW2.Instance.Setup.CopyTo(setupToSend);
                setupToSend.MapType = ItemAsType;
                GameCommand command = GameCommand.Create(GameCommandType.SetupOnly_ChangeSetup);

                command.RelatedSetup = setupToSend;
                World_AIW2.Instance.QueueGameCommand(command);
            }
Exemple #3
0
            public override void HandleClick()
            {
                string seedString = iSeed.Instance.CurrentValue;
                int    seed;

                if (!Int32.TryParse(seedString, out seed))
                {
                    return;
                }
                WorldSetup setupToSend = new WorldSetup();

                World_AIW2.Instance.Setup.CopyTo(setupToSend);
                setupToSend.Seed = seed;
                GameCommand command = GameCommand.Create(GameCommandType.SetupOnly_ChangeSetup);

                command.RelatedSetup = setupToSend;
                World_AIW2.Instance.QueueGameCommand(command);
            }
    protected override void OnUpdate()
    {
        var archeType = EntityManager.CreateArchetype
                        (
            typeof(LifeCell),
            typeof(EntityElement),
            typeof(Renderable),
            typeof(Translation),
            typeof(LocalToWorld)
                        );

        Entities.WithStructuralChanges()
        .WithName("WorldGeneration")
        .WithStoreEntityQueryInField(ref setupQuery)
        .WithoutBurst()
        .ForEach((Entity entity, in GameOfLifeConfig config) =>
        {
            var worldSetupSystem = new WorldSetup()
            {
                WorldSeed             = config.WorldSeed,
                AliveCellPrefab       = config.AliveCell,
                DeadCellPrefab        = config.DeadCell,
                entityManager         = EntityManager,
                NumberOfStartingSeeds = config.NumberOfStartingSeeds,
                cellArcheType         = archeType,
                WorldUpdateRate       = config.WorldUpdateRate,
                ShouldLimitUpdates    = config.LimitUpdateRate,
                CentrePoint           = config.Centre,
                GridSize      = config.WorldSize,
                SystemToUse   = config.SystemToUse,
                ParticleAsset = config.particleAsset,
                MaxParticles  = config.MaxParticles,
                RuleSet       = config.ruleSet
            };

            worldSetupSystem.GenerateLifeSeed();
        }).Run();

        // Then delete all the entities so that the update doesn't run again
        EntityManager.DestroyEntity(setupQuery);
    }