Exemple #1
0
    public void MoveToEmptySlot(GameObject targetObject, ScrSlot emptySlot)
    {
        if (IsNearEmptySlot(targetObject, emptySlot))
        {
            Debug.Log("IsNearEmptySlot");
            Vector2 tempPosition = targetObject.transform.position;

            targetObject.transform.position = emptySlot.GetSlotPosition();
            emptySlot.SetSlotPosition(tempPosition.x, tempPosition.y);

            int tempOrderX = targetObject.GetComponent <ScrBody>().orderX;
            int tempOrderY = targetObject.GetComponent <ScrBody>().orderY;

            targetObject.GetComponent <ScrBody>().orderX = emptySlot.GetOrderX();
            targetObject.GetComponent <ScrBody>().orderY = emptySlot.GetOrderY();

            emptySlot.SetOrder(tempOrderX, tempOrderY);
        }
    }
Exemple #2
0
    void CreatePartition(int ColumnCount)
    {
        for (int i = 0; i < ColumnCount; i++)
        {
            for (int j = 0; j < ColumnCount; j++)
            {
                scrPartition = new ScrPartition();
                scrPartition.Initiate(ColumnCount, partitionWidth, cameraWidth, stageImage, boxBorder, i, j, scrSlots[i, j]);

                if (i == ColumnCount - 1 && j == ColumnCount - 1 - 1)
                {
                    break;
                }
            }
        }

        emptySlot.SetOrder(ColumnCount - 1, ColumnCount - 1);
        emptySlot.SetSlotPosition(scrSlots[ColumnCount - 1, ColumnCount - 1].GetSlotPosition().x, scrSlots[ColumnCount - 1, ColumnCount - 1].GetSlotPosition().y);
        //emptySlot.gets
    }