/// <summary> /// Tries to put object at the spot. /// </summary> /// <returns> /// True if object was accepted, otherwise - false. /// </returns> public bool PutAt(BaseObjectBehaviour obj, long parentUID, Vector3 pos) { TriggerOnDragStart(); bool res = false; RaycastHit hit; var root = uidm.GetRootParentUID(parentUID); // TODO: find the root parent if (root == hand.ModelData.uid) { res = RaycastingHelper.RaycastToHandDropZones(out hit, pos, handPlane.position); } else if (root == table.ModelData.uid) { res = RaycastingHelper.RaycastToTableDropZones(out hit, pos); } else { res = RaycastingHelper.RaycastToTableDropZones(out hit, pos); } TriggerOnDragStop(); if (res) { DropZone dz = hit.transform.GetComponent <DropZone>(); return(dz.Drop(obj, hit.point)); } return(false); }
public override bool Drop(BaseObjectBehaviour droppingObj, Vector3 position) { CardBehaviour droppingCard = droppingObj as CardBehaviour; if (droppingCard != null) { if (!droppingCard.ModelData.allowStacking) { return(false); } DropCard(droppingCard, position); return(true); } DeckBehaviour droppingDeck = droppingObj as DeckBehaviour; if (droppingDeck != null) { DropDeck(droppingDeck, position); return(true); } return(false); }
/// <summary> /// Tries to put object at the spot. /// </summary> /// <returns> /// True if object was accepted, otherwise - false. /// </returns> public bool PutAt(BaseObjectBehaviour obj, Vector3 pos) { TriggerOnDragStart(); bool res = RaycastingHelper.RaycastToTableDropZones(out var hit, pos); TriggerOnDragStop(); if (res) { DropZone dz = hit.transform.GetComponent <DropZone>(); return(dz.Drop(obj, hit.point)); } return(false); }
public override bool Drop(BaseObjectBehaviour droppingObj, Vector3 position) { CardBehaviour droppingCard = droppingObj as CardBehaviour; if (droppingCard == null) { return(false); } if (cardSlotBehaviour.ModelData.cardInSlot == null && cardSlotBehaviour.ModelData.CheckCardEligibility(droppingCard.ModelData)) { cardSlotBehaviour.ModelData.PutCard(droppingCard.ModelData); return(true); } return(false); }
public override bool Drop(BaseObjectBehaviour droppingObj, Vector3 position) { droppingObj.ModelData.parentUID = table.ModelData.uid; droppingObj.ModelData.Position = new Vector2(position.x, position.z); return(true); }
/// <summary> /// Method that processes dropping an object at this drop site. /// </summary> /// <returns> /// True if object was accepted, otherwise - false. /// </returns> public virtual bool Drop(BaseObjectBehaviour droppingObj, Vector3 position) { return(false); }