Esempio n. 1
0
 public static Apollon[] GetApollon(namesKaiju name, int numberName, float version, float thicknessOfTitanium, int levelOfLibido, int count)
 {
     if (numberName > 0 & count > 0)
     {
         Apollon[] masApollon = new Apollon[count];
         for (int i = 0; i < masApollon.Length; i++)
         {
             masApollon[i] = new Apollon(levelOfLibido, thicknessOfTitanium, name.ToString() + numberName++, version);
         }
         return masApollon;
     }
     else
     {
         throw new System.Exception("The parameter is incorrect!");
     }
 }
Esempio n. 2
0
 public Apollon[] GetArrayApollon()
 {
     Kaiju[] k1 = GetArrayForName("Apollon");
     Apollon[] a1 = new Apollon[k1.Length];
     for (int i = 0; i < k1.Length; i++)
     {
         a1[i] = (Apollon)k1[i];
     }
     return a1;
 }
Esempio n. 3
0
        public Kaiju[] ReadFile()
        {
            int counterObj = CountObjInFile();
            Kaiju[] resultArrayKaiju = new Kaiju[counterObj];
            StreamReader sr = new StreamReader(Resource_1.pathSaveKaiju);
            string[] ArrayStringData;
            string tempString;
            string name=null;
            float version = 0;
            int id;
            float thicknessOfTitanium=0;
            int levelOfLibido=0;
            int lightningStrikes=0;
            int distanceOfJump=0;
            int flightSpeed=0;

            for (int i = 0; i < counterObj; i++)
            {
                tempString = sr.ReadLine();
                ArrayStringData = ParseString(tempString);
                for (int j = 0; j < ArrayStringData.Length; j++)
                {
                    if (ArrayStringData[j].IndexOf("id") > -1)
                    {
                        Int32.TryParse(ArrayStringData[j + 1], out id);
                    }
                    if (ArrayStringData[j].IndexOf("Name") > -1)
                    {
                        name = ArrayStringData[j + 1];
                    }
                    if (ArrayStringData[j].IndexOf("Version") > -1)
                    {
                        float.TryParse(ArrayStringData[j + 1], out version);
                    }
                    if (ArrayStringData[j].IndexOf("ThicknessOfTitanium") > -1)
                    {
                        float.TryParse(ArrayStringData[j + 1], out thicknessOfTitanium);
                    }
                    if (ArrayStringData[j].IndexOf("LevelOfLibido") > -1)
                    {
                        Int32.TryParse(ArrayStringData[j + 1], out levelOfLibido);
                    }
                    if (ArrayStringData[j].IndexOf("LightningStrikes") > -1)
                    {
                        Int32.TryParse(ArrayStringData[j + 1], out lightningStrikes);
                    }
                    if (ArrayStringData[j].IndexOf("DistanceOfJump") > -1)
                    {
                        Int32.TryParse(ArrayStringData[j + 1], out distanceOfJump);
                    }
                    if (ArrayStringData[j].IndexOf("FlightSpeed") > -1)
                    {
                        Int32.TryParse(ArrayStringData[j + 1], out flightSpeed);
                    }
                }
                switch (ArrayStringData[0])
                {
                    case "Kaiju":
                        resultArrayKaiju[i] = new Kaiju(name, version);
                        break;
                    case "Titan":
                        resultArrayKaiju[i] = new Titan(thicknessOfTitanium, name, version);
                        break;
                    case "Apollon":
                        resultArrayKaiju[i] = new Apollon(levelOfLibido, thicknessOfTitanium, name, version);
                        break;
                    case "Zeus":
                        resultArrayKaiju[i] = new Zeus(lightningStrikes, thicknessOfTitanium, name, version);
                        break;
                    case "Gorilla":
                        resultArrayKaiju[i] = new Gorilla(distanceOfJump, name, version);
                        break;
                    case "Flying":
                        resultArrayKaiju[i] = new Flying(flightSpeed, name, version);
                        break;
                }
            }
            sr.Close();

            return resultArrayKaiju;
        }