Example #1
0
 public static Zeus[] GetZeus(namesKaiju name, int numberName, float version, float thicknessOfTitanium, int lightningStrikes, int count)
 {
     if (numberName > 0 & count > 0)
     {
         Zeus[] masZeus = new Zeus[count];
         for (int i = 0; i < masZeus.Length; i++)
         {
             masZeus[i] = new Zeus(lightningStrikes, thicknessOfTitanium, name.ToString() + numberName++, version);
         }
         return masZeus;
     }
     else
     {
         throw new System.Exception("The parameter is incorrect!");
     }
 }
Example #2
0
 public Zeus[] GetArrayZeus()
 {
     Kaiju[] k1 = GetArrayForName("Zeus");
     Zeus[] z1 = new Zeus[k1.Length];
     for (int i = 0; i < k1.Length; i++)
     {
         z1[i] = (Zeus)k1[i];
     }
     return z1;
 }
Example #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;
        }