Ejemplo n.º 1
0
 private IPromise <AnimalView> SpawnAnimal(AnimalRemoteDataModel animalModel)
 {
     return(_animalsPool.Spawn <AnimalView>(
                _projectSettings.AnimalsPrefabs.First(a => a.Type.Equals(animalModel.RemoteData.AnimalType)),
                new AnimalViewParams()
     {
         parent = _view.AnimalsRoot,
         AnimalModel = animalModel
     }
                ).Then(v => _animalViews.Add(animalModel.RemoteData.Id, v)));
 }
Ejemplo n.º 2
0
        public static Promise AddAnimal(SignalBus signalBus, AnimalRemoteDataModel animalModel)
        {
            AddAnimalToGroupSignal signal = new AddAnimalToGroupSignal
            {
                AnimalModel = animalModel, OnAnimalAdded = new Promise()
            };

            signalBus.Fire(signal);

            return(signal.OnAnimalAdded);
        }
Ejemplo n.º 3
0
        private void AddAnimalToGroup(AnimalView animalView)
        {
            AnimalRemoteDataModel model = (AnimalRemoteDataModel)animalView.Model;

            AddAnimalToGroupSignal.AddAnimal(SignalBus, model);
        }
Ejemplo n.º 4
0
 private void DeSpawnAnimal(AnimalRemoteDataModel animalModel)
 {
     _animalsPool.Despawn <AnimalView>(
         _projectSettings.AnimalsPrefabs.First(a => a.Type.Equals(animalModel.RemoteData.AnimalType)),
         _animalViews[animalModel.RemoteData.Id]);
 }