示例#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");
        }
示例#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();
        }
示例#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 });
        }
示例#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);
        }
示例#5
0
        public override void SetUp()
        {
            base.SetUp();

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

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

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

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

            Inject(ese, "_removeCmdBufferSystem");
        }
示例#6
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");
        }