예제 #1
0
 public string RandomName(Sexes sex)
 {
     if (sex == Sexes.Girl)
     {
         return(randomService.GetRandom(girls));
     }
     else
     {
         return(randomService.GetRandom(boys));
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        public void Initialize()
        {
            Name      = NameProvider.GetIslandName();
            Alignment = Alignment.Coalition;
            level     = RandomService.GetRandom(1, 10);

            Startup();
        }
예제 #5
0
 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;
         }
     }
 }
예제 #6
0
        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
            }
        }
예제 #7
0
        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();
            }
        }
예제 #8
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
0
 void ChangeIntensity()
 {
     light.intensity = RandomService.GetRandom(MinIntensity, MaxIntensity);
     currentFrame    = 0;
 }