Ejemplo n.º 1
0
        public override void SetUp()
        {
            base.SetUp();
            TileTypeSO sandTileSO = ScriptableObject.CreateInstance <TileTypeSO>();

            sandTileSO.name      = "sand";
            sandTileSO.Cost      = 1f;
            sandTileSO.Color     = Color.red;
            sandTileSO.Range     = 1f;
            sandTileSO.hideFlags = HideFlags.HideAndDontSave;

            ResourceTypeSO coal = ScriptableObject.CreateInstance <ResourceTypeSO>();

            coal.MovementCost  = 2;
            coal.WorkRequired  = 1f;
            coal.PiecesPerWork = 2;

            ResourceTypeSO coalHard = ScriptableObject.CreateInstance <ResourceTypeSO>();

            coalHard.MovementCost  = 2;
            coalHard.WorkRequired  = 4f;
            coalHard.PiecesPerWork = 2;

            ResourceTypeSO fake = ScriptableObject.CreateInstance <ResourceTypeSO>();

            BlobsMemory.FromSOs(new IBlobableSO[] { sandTileSO, coal, coalHard, fake });

            var ese = _currentWorld.CreateSystem <EndSimulationEntityCommandBufferSystem>();

            Inject(ese, "_removeCmdBufferSystem");
        }
Ejemplo n.º 2
0
        private void CreateMap(int mapSize)
        {
            var AllTileSO = new TileTypeSO[10];

            for (int i = 0; i < AllTileSO.Length; i++)
            {
                AllTileSO[i]       = ScriptableObject.CreateInstance <TileTypeSO>();
                AllTileSO[i].name  = i.ToString();
                AllTileSO[i].Cost  = i * i;
                AllTileSO[i].Color = new Color32((byte)i, (byte)i, (byte)i, 1);
                AllTileSO[i].Range = 1f / AllTileSO.Length;
            }

            BlobsMemory.FromSOs(AllTileSO);

            // Create request
            var requestEntity = _entityManager.CreateEntity(typeof(MapRequest));

            _entityManager.SetComponentData(requestEntity, new MapRequest()
            {
                Frequency = new float2(0.1f, 0.1f), MapEdgeSize = mapSize
            });

            var mapSpawnerSystem = _currentWorld.GetOrCreateSystem <MapSpawner>();

            mapSpawnerSystem.Update();

            var movementCostSystem = _currentWorld.GetOrCreateSystem <MovementCostTrackerSystem>();

            movementCostSystem.Update();
        }
Ejemplo n.º 3
0
        public override void SetUp()
        {
            base.SetUp();
            TileTypeSO SandTileSO = ScriptableObject.CreateInstance <TileTypeSO>();

            SandTileSO.name      = _sandName;
            SandTileSO.Cost      = 1f;
            SandTileSO.Color     = Color.red;
            SandTileSO.Range     = 1f;
            SandTileSO.hideFlags = HideFlags.HideAndDontSave;

            BlobsMemory.FromSOs(new[] { SandTileSO });
        }
Ejemplo n.º 4
0
        public override void SetUp()
        {
            base.SetUp();
            TileTypeSO[] AllTileSO = new TileTypeSO[10];
            for (int i = 0; i < AllTileSO.Length; i++)
            {
                AllTileSO[i]           = ScriptableObject.CreateInstance <TileTypeSO>();
                AllTileSO[i].name      = i.ToString();
                AllTileSO[i].Cost      = i * i;
                AllTileSO[i].Color     = new Color32((byte)i, (byte)i, (byte)i, 1);
                AllTileSO[i].Range     = 1f / AllTileSO.Length;
                AllTileSO[i].hideFlags = HideFlags.HideAndDontSave;
            }

            BlobsMemory.FromSOs(AllTileSO);
        }
Ejemplo n.º 5
0
        public override void SetUp()
        {
            base.SetUp();
            TileTypeSO SandTileSO = ScriptableObject.CreateInstance <TileTypeSO>();

            SandTileSO.name      = "sand";
            SandTileSO.Cost      = 1f;
            SandTileSO.Color     = Color.red;
            SandTileSO.Range     = 1f;
            SandTileSO.hideFlags = HideFlags.HideAndDontSave;

            ResourceTypeSO coal = ScriptableObject.CreateInstance <ResourceTypeSO>();

            coal.MovementCost = 2;
            coal.UnitSize     = 1f;

            BlobsMemory.FromSOs(new IBlobableSO[] { SandTileSO, coal });

            var ese = _currentWorld.CreateSystem <EndSimulationEntityCommandBufferSystem>();

            Inject(ese, "_removeCmdBufferSystem");
        }