Beispiel #1
0
 protected override void OnCreateManager()
 {
     _playerQuery = GetEntityQuery(new ComponentType[]
     {
         ComponentType.ReadWrite <Translation>(),
         ComponentType.ReadWrite <ArcState>(),
         ComponentType.Exclude <Scale>(),
     });
     _newGameQuery = GetEntityQuery(new ComponentType[]
     {
         ComponentType.ReadWrite <NewGameTag>(),
     });
     _tankFireSystem = World.GetOrCreateSystem <TankFireSystem>();
 }
        protected override void OnCreateManager()
        {
            _cannonballSystem = World.GetOrCreateSystem <CannonballSystem>();
            _tankFireSystem   = World.GetOrCreateSystem <TankFireSystem>();
            _playerPosCache   = World.GetOrCreateSystem <PlayerPositionCacheSystem>();
            uint   seederSeed = math.max(1, (uint)System.DateTime.Now.Ticks);
            Random rngSeeder  = new Random(seederSeed);

            _threadRngs = new NativeArray <Random>(JobsUtility.MaxJobThreadCount, Allocator.Persistent);
            for (int i = 0; i < _threadRngs.Length; ++i)
            {
                var rng = _threadRngs[i];
                rng.InitState(rngSeeder.NextUInt());
                _threadRngs[i] = rng;
            }
        }