Example #1
0
        // Метод генерирующий список объектов в декартовом простраснтве
        private static ArrayList GenerateShapes()
        {
            Random    rng          = new Random();
            ArrayList masArrayList = new ArrayList();
            int       count        = rng.Next(1, 4);

            Console.WriteLine($"Создается {count} количество элементов Circle:");
            for (int i = 0; i < count; i++)
            {
                masArrayList.Add(Circle.EnteringParameters());
            }

            Console.WriteLine($"Создается {count = rng.Next(1, 4)} количество элементов Phere:");
            for (int i = 0; i < count; i++)
            {
                masArrayList.Add(Phere.EnteringParameters());
            }

            Console.WriteLine($"Создается {count = rng.Next(1, 4)} количество элементов Rectangle:");
            for (int i = 0; i < count; i++)
            {
                masArrayList.Add(Rectangle.EnteringParameters());
            }

            Console.WriteLine($"Создается {count = rng.Next(1, 4)} количество элементов Coub:");
            for (int i = 0; i < count; i++)
            {
                masArrayList.Add(Coub.EnteringParameters());
            }

            return(masArrayList);
        }
Example #2
0
    // Use this for initialization
    void Start()
    {
        getText   = GameObject.Find("levelShow").GetComponent <Text>();
        getNumber = GameObject.Find("Main Camera").GetComponent <Coub>();

        GOlevel     = GameObject.Find("LWN").GetComponent <Text>();
        GOscore     = GameObject.Find("SWN").GetComponent <Text>();
        GOincrease  = GameObject.Find("IncreaseNumber").GetComponent <Text>();
        GObestScore = GameObject.Find("BestScoreNumber").GetComponent <Text>();
    }
Example #3
0
File: Hero.cs Project: furyG/Cubes
 // Start is called before the first frame update
 void Start()
 {
     HeroCurrHP = 3;
     mainScript = Camera.main.GetComponent <Coub>();
     targetFind = GameObject.Find("target");
     if (targetFind == null)
     {
         GameObject targetSpawn = Instantiate <GameObject>(targetPrefab);
         targetSpawn.transform.position = new Vector3(pos.x, pos.y, pos.z - 1);
         targetSpawn.transform.parent   = this.transform;
     }
     target = GetComponent <Transform>();
 }
Example #4
0
        private static void RunMethodShapes()
        {
            Console.WriteLine("Задача: Использовать общие классы с проектом Shapes.");

            Console.WriteLine("1. Произведем преобразование типов: Coub -> Rectangle. Для этого создадим объект куб:");
            Coub      coub = Coub.EnteringParameters();
            Rectangle rect = coub;

            // Если нам надо получить метод rect.ToString() соотвествующий классу Rectangle, то необходимо исопльзовать сокрытие методов
            Console.WriteLine($"Получим объект Rectangle со следующими параметрами: \nHeight - {rect.Height}\nWidth - {rect.Width}\n{rect.ToString()}\n");

            Console.WriteLine("2. Произведем преобразование типов: Phere -> Circle. Для этого создадим объект шар:");
            Phere  phere  = Phere.EnteringParameters();
            Circle circle = phere;

            Console.WriteLine($"Получим объект Circle со следующими параметрами: \nRadius - {circle.Radius}\n{circle.ToString()}\n");

            Console.WriteLine("3. Произведем неявное преобразование типов: Circle -> double[]. Для этого создадим объект круг:");
            Circle circle2 = Circle.EnteringParameters();

            double[] mas = circle2;
            Console.WriteLine($"Получим массив со следующими параметрами: [Radius- {mas[0]}, Perimeter - {mas[1]}, Area - {mas[2]}]\n");

            Console.WriteLine("4. Произведем неявное преобразование типов: Phere -> double[]. Для этого создадим объект шар:");
            Phere phere2 = Phere.EnteringParameters();

            double[] mas2 = phere2;
            Console.WriteLine($"Получим массив со следующими параметрами: [Radius- {mas2[0]}, Perimeter - {mas2[1]}, Area - {mas2[2]}]\n");

            Console.WriteLine("5. Произведем явное преобразование типов: double (value = 3.4) -> Circle.");
            Circle circle3 = (Circle)3.4;

            Console.WriteLine($"Radius - {circle3.Radius}\n{circle3.ToString()}\n");
            Console.ReadKey();

            Console.WriteLine("6. Произведем явное преобразование типов: double (value = 3.7) -> Phere.");
            Phere phere3 = (Phere)3.7;

            Console.WriteLine($"Radius - {phere3.Radius}\n{phere3.ToString()}\n");
            Console.ReadKey();
        }
Example #5
0
 // Use this for initialization
 void Start()
 {
     timerFind       = GameObject.Find("Timer").GetComponent <Image>();
     levelNumberFind = Camera.main.GetComponent <Coub>();
 }