public TerraWorldDataStreamer(
     TerraWorldViewModel terraWorldViewModel,
     TerraWorldService terraWorldService,
     TerraChunkService terraChunkService,
     TerraEntitiesViewModel terraEntitiesViewModel,
     TerraDBService db)
 {
     _terraWorldViewModel    = terraWorldViewModel;
     _terraWorldService      = terraWorldService;
     _terraChunkService      = terraChunkService;
     _terraEntitiesViewModel = terraEntitiesViewModel;
     _db = db;
 }
예제 #2
0
        private void CreateEntity(ITerraEntityType type)
        {
            RuntimeTerraEntity     entity = Game.Instance.GetService <TerraEntitesService>().CreateEntity(type);
            TerraEntitiesViewModel vm     = Game.Instance.GetViewModel <TerraEntitiesViewModel>(0);
            RuntimeTerraEntity     player = vm.GetEntity(TerraGameResources.Instance.TerraEntityPrefabConfig.PlayerConfig.Data);

            if (player != null)
            {
                entity.Position.Set(new Vector3(player.Position.Data.x, player.Position.Data.y + 2,
                                                player.Position.Data.z));
            }

            vm.AddEntity(entity);
        }
예제 #3
0
        public TerraView()
        {
            _terraWorldViewModel    = Game.Instance.GetViewModel <TerraWorldViewModel>(0);
            _terraEntitiesViewModel = Game.Instance.GetViewModel <TerraEntitiesViewModel>(0);
            _terraWorldService      = Game.Instance.GetService <TerraWorldService>();
            _terraChunkService      = Game.Instance.GetService <TerraChunkService>();
            _db = Game.Instance.GetService <TerraDBService>();

            _dataStreamers = new ViewDataStreamerGroup(new IDataStreamer[]
            {
                new TerraWorldDataStreamer(
                    _terraWorldViewModel,
                    _terraWorldService,
                    _terraChunkService,
                    _terraEntitiesViewModel,
                    _db
                    )
            });

            _terraWorldViewModel.OnWorldSet     += TerraWorldViewModelOnWorldSet;
            _terraEntitiesViewModel.OnAddEntity += TerraEntitiesViewModelOnAddEntity;
        }
 private void Start()
 {
     _terraEntitiesViewModel              = Game.Instance.GetViewModel <TerraEntitiesViewModel>(0);
     _terraEntitiesViewModel.OnAddEntity += OnAddEntity;
     _terraEntityPrefabConfig             = _terraEntitiesViewModel.TerraEntityPrefabConfig;
 }