예제 #1
0
 public GameObject GetFirstOpenSlot()
 {
     for (int i = 0; i < slots.Count; i++)
     {
         GameObject slot      = slots[i];
         BenchSlot  benchSlot = slot.GetComponent <BenchSlot>();
         if (benchSlot.empty)
         {
             return(slot);
         }
     }
     return(null);
 }
예제 #2
0
파일: Game.cs 프로젝트: Patiun/AutoChess
 public void SelectSlot(GameObject slotObj)
 {
     selectedSlot = slotObj;
     if (selectedUnit)
     {
         print("HAS UNIT");
         BenchSlot slot = slotObj.GetComponent <BenchSlot>();
         if (slot.empty)
         {
             print("NOT EMPTY");
             MoveUnitToSlot(selectedUnit, selectedSlot);
         }
     }
 }
예제 #3
0
파일: Unit.cs 프로젝트: Patiun/AutoChess
    public void MoveToSlot(GameObject slotObj)
    {
        if (currentTile)
        {
            currentTile.RemoveUnit(gameObject);
        }
        if (currentSlot)
        {
            currentSlot.RemoveUnit(gameObject);
        }
        BenchSlot slot = slotObj.GetComponent <BenchSlot>();

        currentSlot        = slot;
        transform.position = slot.GetUnitSlotPosition();
        slot.PlaceUnit(gameObject);
        onField = false;
    }