public void SetTileType(int x, int y, int change_type)
    {
        //Debug.Log("Set tile tpye is " + change_type);
        toys obj = Array.Find(m_BoardList, p => (p.x_ == x && p.y_ == y));

        obj.GetTileScript().SetTileID(change_type);
    }
    public GameObject GetTileGameObject(int x, int y)
    {
        toys obj = Array.Find(m_BoardList, p => (p.x_ == x && p.y_ == y));

        if (obj != null)
        {
            return(obj.type_);
        }
        //Debug.Log("GetTileScript is Null");
        return(null);
    }
    public int GetTileType(int x, int y)
    {
        toys obj = Array.Find(m_BoardList, p => (p.x_ == x && p.y_ == y));

        if (obj != null)
        {
            //Debug.Log("x = " + x + " y = " + y + " id = " + obj.GetTileScript().GetTileID());
            return(obj.GetTileScript().GetTileID());
        }
        //Debug.Log("x = " + x + " y = " + y + " GetTileType is Block");
        return(0);
    }
    public void ChangeTilePos(int pos1_x, int pos1_y, int pos2_x, int pos2_y)
    {
        toys obj1 = Array.Find(m_BoardList, p => (p.x_ == pos1_x && p.y_ == pos1_y));
        toys obj2 = Array.Find(m_BoardList, p => (p.x_ == pos2_x && p.y_ == pos2_y));

        if (obj1 != null && obj2 != null)
        {
            int temp_x = obj1.GetTileScript().m_x;
            int temp_y = obj1.GetTileScript().m_y;

            obj1.GetTileScript().SetTilePos(obj2.GetTileScript().m_x, obj2.GetTileScript().m_y);
            obj2.GetTileScript().SetTilePos(temp_x, temp_y);

            obj1.x_ = obj2.x_;
            obj1.y_ = obj2.y_;
            obj2.x_ = temp_x;
            obj2.y_ = temp_y;
        }
        //Debug.Log("ChangeTilePos is Null");
    }
Beispiel #5
0
        static void Main(string[] args)
        {
            toys[] array = new toys[]
            {
                new toys("Солдатікі", 250, 4),
                new toys("Лего", 400, 4),
                new toys("Машинка", 50, 2),
                new toys("Палка", 2, 7),
                new toys("Аніме статуйка", 500, 18)
            };

            Console.WriteLine("База даних: ");
            foreach (toys date in array)
            {
                date.info();
            }

            Console.WriteLine("-----------------------------------------------------------");
            Console.Write("Введіть сумму яку ви хочете потратити: ");
            double text = Convert.ToDouble(Console.ReadLine());

            int j = -1, rez = 0;

            for (int i = 0; i < array.Count(); i++)
            {
                j++;
                if (array[i].price <= text)
                {
                    rez = j;
                    Console.WriteLine($"Іграшка знайдена: {array[rez].name} | Ціна: {array[rez].price} | Мінімальний вік: {array[rez].age}");
                }
            }

            if (rez == -1)
            {
                Console.WriteLine($"за {text} грн нічого предбати не можна");
            }

            Console.ReadKey();
        }
    public void SetRollingTop(int x, int y)
    {
        toys obj = Array.Find(m_BoardList, p => (p.x_ == x && p.y_ == y));

        obj.GetTileScript().SetTileID(Param_Script.ROLLING_TOP_ID);
    }