Instance() public static méthode

public static Instance ( ) : Settings
Résultat Settings
Exemple #1
0
        public Animal(int weight, int range, animalType type, int weightGain)
        {
            this.weight     = weight;
            this.range      = range;
            this.weightGain = weightGain;
            this.type       = type;
            alive           = true;
            locationX       = random.Next(0, Settings.Instance().NumbersOfAreas);
            locationY       = random.Next(0, Settings.Instance().NumbersOfAreas);

            if (random.Next(1, 3) == 1)
            {
                this.gender = gender.male;
            }
            else
            {
                gender = gender.female;
            }
        }
Exemple #2
0
 public void Move()
 {
     while (true)
     {
         int temp = random.Next(locationX - range, locationX + range + 1);
         if (temp >= 0 && temp < Settings.Instance().NumbersOfAreas)
         {
             locationX = temp;
             break;
         }
     }
     while (true)
     {
         int temp = random.Next(locationY - range, locationY + range + 1);
         if (temp >= 0 && temp < Settings.Instance().NumbersOfAreas)
         {
             locationY = temp;
             break;
         }
     }
 }