public void OnBeginDrag(PointerEventData d) { if (gameState.cardIsPlayable(this, ((Card)(this.GetComponent <Card>())).ac)) { this.dragging = true; dragInProgress = true; this.vOffset.x = this.transform.position.x - d.position.x; this.vOffset.y = this.transform.position.y - d.position.y; this.transform.rotation = vZero3D; this.returnParent = this.transform.parent; DropZone parentZone = (DropZone)this.transform.parent.gameObject.GetComponent <DropZone>(); if (parentZone != null) { this.origin = parentZone.slotIndex > -1 ? enCardLocation.Slot : enCardLocation.Hand; } this.transform.SetParent(this.transform.parent.parent); this.GetComponent <CanvasGroup>().blocksRaycasts = false; this.deflate(); } else { this.dragging = false; dragInProgress = false; } }
public void Start() { this.focusCard = GameObject.Find("FocusCard"); if (this.transform.parent != null && this.transform.parent.GetComponent <DropZone>() != null) { this.belongsToPlayer = this.transform.parent.GetComponent <DropZone>().belongsToPlayer; this.returnParent = this.transform.parent; this.origin = this.returnParent.GetComponent <DropZone>().slotIndex > -1 ? enCardLocation.Slot : enCardLocation.Hand; } this.gameState = (GameState)GameObject.Find("GameState").GetComponent <GameState>(); }