Instance() 공개 정적인 메소드

public static Instance ( ) : Settings
리턴 Settings
예제 #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;
            }
        }
예제 #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;
         }
     }
 }