private void ProcessMonsterDeath(IActor actor) { if (actor is null) { throw new ArgumentNullException(nameof(actor)); } if (actor.Person is not MonsterPerson monsterPerson) { return; } var monsterScheme = monsterPerson.Scheme; var dropSchemes = GetMonsterDropTables(monsterScheme); var loot = new DropTableLoot(dropSchemes, _dropResolver); var staticObject = new StaticObject(actor.Node, loot.Purpose, default); staticObject.AddModule <IPropContainer>(loot); if (loot.Content.CalcActualItems().Any()) { StaticObjectManager.Add(staticObject); } if (ScoreManager != null) { ScoreManager.CountMonsterDefeat(monsterPerson); } }
private void LootContainer_ItemsRemoved(object sender, PropStoreEventArgs e) { var container = (IPropContainer)sender; if (!container.Content.CalcActualItems().Any()) { var staticObject = StaticObjectManager.Items.Single(x => ReferenceEquals(x.GetModuleSafe <IPropContainer>(), container)); StaticObjectManager.Remove(staticObject); } }
private void LootContainer_ItemsRemoved(object?sender, PropStoreEventArgs e) { if (sender is null) { throw new InvalidOperationException("The handler can work only for instance. Sender can't be null."); } var container = (IPropContainer)sender; if (!container.Content.CalcActualItems().Any()) { var staticObject = StaticObjectManager.Items.Single(x => ReferenceEquals(x.GetModuleSafe <IPropContainer>(), container)); StaticObjectManager.Remove(staticObject); } }
public ISector Create(ISectorMap map, ILocationScheme locationScheme) { var actorManager = new ActorManager(); var propContainerManager = new StaticObjectManager(); var sector = new Sector(map, actorManager, propContainerManager, _dropResolver, _schemeService, _equipmentDurableService) { Scheme = locationScheme }; return(sector); }
public async Task <ISector> GenerateAsync(ISectorNode sectorNode) { var sectorFactoryOptions = new SectorMapFactoryOptions(sectorNode.SectorScheme.MapGeneratorOptions); var map = await _mapFactory.CreateAsync(sectorFactoryOptions); var actorManager = new ActorManager(); var staticObjectManager = new StaticObjectManager(); var sector = new Sector(map, actorManager, staticObjectManager, _dropResolver, _schemeService, _equipmentDurableService); return(sector); }
void Start() { //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x; platformWidths = new float[theObjectPools.Length]; for (int i = 0; i < theObjectPools.Length; i++) { platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x; } minHeight = transform.position.y; maxHeight = maxHeightPoint.position.y; theCoinGenerator = FindObjectOfType <CoinGenerator>(); theStaticObjectGenerator = FindObjectOfType <StaticObjectManager>(); theEnemyGenerator = FindObjectOfType <EnemyGeneratorManager>(); }
/// <inheritdoc/> protected override ISectorEntityManager <IStaticObject> CreateManager() { var staticObjectManager = new StaticObjectManager(); return(staticObjectManager); }