Esempio n. 1
0
    protected void Awake()
    {
        FilterRules weaponHolderFilterRules = FilterRulesBuilder.SetupHasTagBuilder("WeaponDisplay")
                                              .AddHasComponentRule <Weapon>(true).Result();

        _weaponHolderFilter = EntityFilter.Create(weaponHolderFilterRules, OnEntityTracked, OnEntityUntracked);
    }
Esempio n. 2
0
        protected void Awake()
        {
            _entityFilter = EntityFilter <CommercialFilterData> .Create(OnTracked, OnUntracked);

            _building1 = new Building(50);
            _building2 = new Building(75);
        }
Esempio n. 3
0
    protected void Awake()
    {
        FilterRules playerFilterRules = FilterRulesBuilder.SetupHasTagBuilder("Player")
                                        .AddHasComponentRule <PlatformerMov2D>(true)
                                        .AddHasComponentRule <Weapon>(true)
                                        .Result();

        _playerControllerFilter = EntityFilter.Create(playerFilterRules, null, null);
    }
Esempio n. 4
0
        protected void Awake()
        {
            _entityFilter = EntityFilter <HealthFilterData> .Create(new TestModule(), OnTracked, OnUntracked);

            _character  = new Character(50);
            _character2 = new Character(75);

            // Call Flush when you need the entities within the same frame, else the entities will be added to the system the next frame
            // EntityTracker.Instance.Flush();
        }
Esempio n. 5
0
    protected override void Awake()
    {
        base.Awake();

        _health = gameObject.GetComponent <Health>();

        FilterRules waypointsFilterRules = FilterRulesBuilder.SetupNoTagsBuilder()
                                           .AddHasComponentRule <AIPath>(true).Result();

        _waypointsFilter = EntityFilter.Create(waypointsFilterRules, null, null);
    }
Esempio n. 6
0
        public void TestECS()
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            List <EntityUnit> entityUnits = new List <EntityUnit>();

            for (int i = 0; i < TestAmount; i++)
            {
                entityUnits.Add(new EntityUnit(100, i > TestAmount / 2));
            }

            // Call Flush when you need the entities within the same frame, else the entities will be added to the system the next frame
            EntityTracker.Instance.Flush();

            string cc = "";

            for (int i = 0; i < ListsAmount; i++)
            {
                if (i % 2 == 0)
                {
                    HealthFilterData[] units = EntityFilter <HealthFilterData> .Create(null, null).GetAllData();

                    for (int j = 0; j < units.Length; j++)
                    {
                        cc += i;
                    }
                }
                else
                {
                    DamageFilterData[] units = EntityFilter <DamageFilterData> .Create(null, null).GetAllData();

                    for (int j = 0; j < units.Length; j++)
                    {
                        cc += i;
                    }
                }
            }

            stopWatch.Stop();
            UnityEngine.Debug.Log(stopWatch.ElapsedMilliseconds.ToString("#,##0.00") + " < ECS");
            UnityEngine.Debug.Log(cc.Length);
        }