Пример #1
0
 private bool Move(SlotComponent slot, int step)
 {
     if (current != slot)
     {
         if (slot.IsEmpty)
         {
             slot.ReserveHold(this);
             SetSlot(slot);
         }
         else if (slot.IsMergable(this))
         {
             slot.ReserveMerger(this);
             SetSlot(slot);
         }
         else
         {
             Debug.LogError("maybe wrong box moving logic (id:" + id + ")");
             return(false);
         }
         float t = Mathf.Clamp(Mathf.Abs(step), 0, 3) * 0.05f;
         tween = true;
         LeanTween.move(gameObject, slot.transform.position, t).setEase(LeanTweenType.linear).setOnComplete(HandleMove);
         return(true);
     }
     return(false);
 }
Пример #2
0
 public SlotComponent MostDown(BoxComponent box)
 {
     if (DOWN != null)
     {
         if (DOWN.IsEmpty)
         {
             return(DOWN.MostDown(box));
         }
         else if (DOWN.IsMergable(box))
         {
             return(DOWN);
         }
         else
         {
             return(this);
         }
     }
     else
     {
         return(this);
     }
 }
Пример #3
0
 public SlotComponent MostRight(BoxComponent box)
 {
     if (RIGHT != null)
     {
         if (RIGHT.IsEmpty)
         {
             return(RIGHT.MostRight(box));
         }
         else if (RIGHT.IsMergable(box))
         {
             return(RIGHT);
         }
         else
         {
             return(this);
         }
     }
     else
     {
         return(this);
     }
 }
Пример #4
0
 public SlotComponent MostUp(BoxComponent box)
 {
     if (UP != null)
     {
         if (UP.IsEmpty)
         {
             return(UP.MostUp(box));
         }
         else if (UP.IsMergable(box))
         {
             return(UP);
         }
         else
         {
             return(this);
         }
     }
     else
     {
         return(this);
     }
 }
Пример #5
0
 public SlotComponent MostLeft(BoxComponent box)
 {
     if (LEFT != null)
     {
         if (LEFT.IsEmpty)
         {
             return(LEFT.MostLeft(box));
         }
         else if (LEFT.IsMergable(box))
         {
             return(LEFT);
         }
         else
         {
             return(this);
         }
     }
     else
     {
         return(this);
     }
 }