protected virtual IEnumerator MoveToRoutine(RectTransform Slot) { OnStartMoveSlot(); yield return(null); Vector2 Pos = Slot.position; Vector2 Dir = (Pos - (Vector2)transform.position).normalized * 18; while (Vector2.Distance(transform.position, Pos) > Dir.magnitude + 0.1f) { transform.position += (Vector3)Dir; OnUpdateMoveSlot(); yield return(null); } transform.position = Slot.transform.position; if (ZoneAt != null && Data.Category != CardCategory.Obstacle) { transform.SetSiblingIndex(ZoneAt.GetIndex(this)); } yield return(null); OnArriveMoveSlot(); }
public virtual void OnStateChange(PlayState NewState) { if (Data as ObstacleData == null && Show && !Disposed) { if (NewState == PlayState.PlayCards || NewState == PlayState.AssignDamage) { if (NewState == PlayState.PlayCards) { GetComponent <DraggableElement>().enabled = true; } else if (NewState == PlayState.AssignDamage) { if (ZoneAt.Equals(UIController.Instance.PlayZone)) { GetComponent <DraggableElement>().enabled = true; } else { GetComponent <DraggableElement>().enabled = false; } } } else { if (!Disposed && ZoneAt != null && ZoneAt.Equals(UIController.Instance.PlayZone)) { Dispose(); } GetComponent <DraggableElement>().enabled = false; } } }
protected virtual IEnumerator MoveToRoutine(Vector2 Pos) { OnStartMoveSlot(); yield return(null); Vector2 Dir = (Pos - (Vector2)transform.position).normalized * 18; while (Vector2.Distance((Vector2)transform.position, Pos) > Dir.magnitude + 0.1f) { transform.position += (Vector3)Dir; OnUpdateMoveSlot(); yield return(null); } transform.position = Pos; if (ZoneAt != null) { transform.SetSiblingIndex(ZoneAt.GetIndex(this)); } yield return(null); OnArriveMoveSlot(); }
public virtual void OnDrop(PointerEventData eventData) { ZoneAt.OnDrop(eventData); }