public void SpawnNewMobs(MobScriptable mobScriptable, int amount) { this.ForceInitialization(); List <TileMapComponnent> tileMapWithoutObjectsList = _tileMapChildrensList .Where(e => !e.HasObstacle && e.Side != EnumSide.BOTTOM && e.Side != EnumSide.BOTTOM_RIGHT && e.Side != EnumSide.LEFT_BOTTOM).ToList(); List <int> indexToSpanw = new List <int>(); while (amount != 0) { int index = UnityEngine.Random.Range(0, tileMapWithoutObjectsList.Count); if (indexToSpanw.Any(e => e == index)) { continue; } else { indexToSpanw.Add(index); amount--; } } foreach (int index in indexToSpanw) { TileMapComponnent tileMap = tileMapWithoutObjectsList[index]; GameObject mobGameObject = GameObject.Instantiate(mobScriptable.MobPrefab, tileMap.transform.position, Quaternion.identity); mobGameObject.GetComponentInChildren <MobStructure>().TunIntoAMob(mobScriptable, _mapComponent.Tier); } }
public void TunIntoAMob(MobScriptable mobScriptable, int mapTier = 0) { if (_hasTurnedIntoAMob) { return; } _hasTurnedIntoAMob = true; _mobScriptable = mobScriptable; _mobAnimator.runtimeAnimatorController = _mobScriptable.MobAnimator; mobScriptable.ApplyMultiplier(mapTier); // => DamageTakerOptions _damageTakerComponent.TurnItIntoAMob(mobScriptable); // => DamageDealerOptions _damageDealerComponent.TurnItIntoAMob(mobScriptable); }
public void TurnItIntoAMob(MobScriptable mobScriptable) { _damage = mobScriptable.Damage; _cdwDamage = mobScriptable.CdwDamage; }
internal void TurnItIntoAMob(MobScriptable mobScriptable) { _health = mobScriptable.Health; _fullHealth = _health; }