public string RandomName(Sexes sex) { if (sex == Sexes.Girl) { return(randomService.GetRandom(girls)); } else { return(randomService.GetRandom(boys)); } }
void SpawnEntity(GameObject prefab, Transform container, Transform position) { var rotation = new Vector3(0f, RandomService.GetRandom(0, 360), 0f); var building = Instantiate(prefab, position.position, Quaternion.Euler(rotation)); building.transform.SetParent(container); }
void Start() { var islandLevel = StaticPersistence.GameState != null ? StaticPersistence.GameState.Mission.MissionIsland.Level : RandomService.GetRandom(1, 10); var islandName = StaticPersistence.GameState != null ? StaticPersistence.GameState.Mission.MissionIsland.Name : NameProvider.GetIslandName(); StatusUI.Initialize(islandName, islandLevel); DefensePlacer.Initialize(islandLevel); DefensePlacer.PlaceDrones(); DefensePlacer.PlaceTurrets(); DefensePlacer.PlaceSAMTurrets(); DefensePlacer.PlaceDefenses(); buildings = BuildingContainer.GetComponentsInChildren <Building>(); hitPoints = buildings.Count(); TargetProvider = new CoalitionTargetProvider(); foreach (var b in buildings) { var healthBar = IslandStatus.AddBuilding(b.Name); healthBar.Initialize(b.Health.BaseHitPoints); b.Initialize(this, VehicleContainer, TurretContainer, Patrols, healthBar.UpdateHp); } }
public void Initialize() { Name = NameProvider.GetIslandName(); Alignment = Alignment.Coalition; level = RandomService.GetRandom(1, 10); Startup(); }
void RandomizePassable(CellData cell, int wallChance) { if (!GridHelper.IsBorderTile(cell.Coordinate, SizeX, SizeZ)) { var roll = RandomService.GetRandom(1, 101); if (roll > wallChance) { cell.Passable = true; } } }
private void CreerEquipe() { int quantite = randomService.GetRandom(2, 7); for (int i = 0; i < quantite; i++) { ForceType force = randomService.GetRandomFrom <ForceType>(); // Joueurs.Add(new Joueur(joueur, force)); Joueurs.Add(new Joueur("J" + (i + 1), force)); // Joueurs.Add(new Joueur(nameService.CreateRandomName(), force)); // création de nom aléatoire } }
private void OnTriggerEnter(Collider other) { var pickup = other.GetComponent <AmmoPickup>(); if (pickup) { Player.AddAmmo(AmmoType.Pistol, RandomService.GetRandom(5, 10)); Player.AddAmmo(AmmoType.Shotgun, RandomService.GetRandom(2, 6)); Player.AddAmmo(AmmoType.Shotgun, RandomService.GetRandom(8, 17)); pickup.Consume(); } }
private bool QuilleTombee(bool forceEgale) { //return randomService.GetRandom(0, 10) < (forceEgale ? 6 : 3); // le "?" est la forme contractée de "if" et les ":" remplace le "else" // la forme abrégée ne marche que si uniquement il y a un "else" //remplace tout le code dessous int proba = 3; if (forceEgale) { proba = 6; } return(randomService.GetRandom(0, 10) < proba); }
public IEnumerable <NewsStory> Get() { //Wait anywhere between 200ms and 3000ms Thread.Sleep(_rnd.GetRandom(200, 3000)); if (!_cache.TryGetValue("newsitems", out _newsItems)) { _newsItems = _newsService.GetNews(_feedUrl).Result; var opts = new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(1)); _cache.Set("newsitems", _newsItems); } return(_newsItems); }
public static PistolStats GenerateNewPistol(ItemQuality quality) { var genData = PistolGenerationPresets.GenData[quality]; var stats = new PistolStats(); stats.Accuracy = RandomService.GetRandom(genData.MinAccuracy, genData.MaxAccuracy); stats.MinAccuracy = stats.Accuracy > AbsoluteMinAccuracy * 2 ? stats.Accuracy - 15 : AbsoluteMinAccuracy; stats.AimRecovery = 0.8f; stats.Quality = quality; stats.DamagePerRound = RandomService.GetRandom(genData.MinDamagePerRound, genData.MaxDamagePerRound); stats.RateOfFire = RandomService.GetRandom(genData.MinRateOfFire, genData.MaxRateOfFire); stats.Recoil = RandomService.GetRandom(genData.MinRecoil, genData.MaxRecoil); stats.AmmoPerMag = RandomService.GetRandom(genData.MinAmmoPerMag, genData.MaxAmmoPerMag); stats.ReloadTime = 1f; return(stats); }
public static MinigunStats GenerateNewMinigun(ItemQuality quality) { var genData = MinigunGenerationPresets.GenData[quality]; var stats = new MinigunStats(); stats.Accuracy = RandomService.GetRandom(genData.MinAccuracy, genData.MaxAccuracy); stats.MinAccuracy = stats.Accuracy - 20; stats.AimDistance = 20f; stats.AimRecovery = 0.8f; stats.Quality = quality; stats.DamagePerRound = RandomService.GetRandom(genData.MinDamagePerRound, genData.MaxDamagePerRound); stats.PushForce = stats.DamagePerRound * 10; stats.Range = RandomService.GetRandom(genData.MinRange, genData.MaxRange); stats.RateOfFire = RandomService.GetRandom(genData.MinRateOfFire, genData.MaxRateOfFire); stats.Recoil = RandomService.GetRandom(genData.MinRecoil, genData.MaxRecoil); stats.AmmoPerMag = RandomService.GetRandom(genData.MinAmmoPerMag, genData.MaxAmmoPerMag); return(stats); }
void ChangeIntensity() { light.intensity = RandomService.GetRandom(MinIntensity, MaxIntensity); currentFrame = 0; }