private void OnTriggerEnter2D(Collider2D collision) { if (dragging) { DropCardController controller = collision.gameObject.GetComponent <DropCardController>(); if (controller != null) { Colliders.Add(collision.gameObject); } } }
public static GameObject DrawBuildProjectCard(Card c, Vector2 coords) { GameObject gameObject = DrawCard(c, coords.x, coords.y, D.CardWidth, D.CardHeight, false); DropCardController dcc = gameObject.AddComponent <DropCardController>(); dcc.Card = c; dcc.DragDropAction = DragDropAction.BuildProject; gameObject.AddComponent <ClickActionScript>() .ClickMethod = (item) => { PopupsController.ShowCardZoomPopup(c); }; return(gameObject); }
public void HandleCardLeaveAction(GameObject playerCardObject, GameObject targetCardObject) { targetCardObject.ResetColor(); DropCardController controller = targetCardObject.GetDragDropController(); }
public static DropCardController GetDragDropController(this GameObject obj) { DropCardController controller = obj.GetComponent <DropCardController>(); return(controller); }