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))); }
public static Promise AddAnimal(SignalBus signalBus, AnimalRemoteDataModel animalModel) { AddAnimalToGroupSignal signal = new AddAnimalToGroupSignal { AnimalModel = animalModel, OnAnimalAdded = new Promise() }; signalBus.Fire(signal); return(signal.OnAnimalAdded); }
private void AddAnimalToGroup(AnimalView animalView) { AnimalRemoteDataModel model = (AnimalRemoteDataModel)animalView.Model; AddAnimalToGroupSignal.AddAnimal(SignalBus, model); }
private void DeSpawnAnimal(AnimalRemoteDataModel animalModel) { _animalsPool.Despawn <AnimalView>( _projectSettings.AnimalsPrefabs.First(a => a.Type.Equals(animalModel.RemoteData.AnimalType)), _animalViews[animalModel.RemoteData.Id]); }