Esempio n. 1
0
    public override void OnEndDrag(PointerEventData eventData)
    {
        isDragging = false;

        GamePipeEndView endView = gamePlumbingDragView.FinishPipeDrag(eventData);

        if (endView != null && this != null)
        {
            UpdatePipeEnd(endView.PipeEnd);
        }
    }
 public override void OnEndDrag(PointerEventData eventData)
 {
     if (isHolding)
     {
         GamePipeEndView endView = gamePlumbingDragView.FinishPipeDrag(eventData);
         if (endView != null)
         {
             gamePlumbingController.SetPipeFromSpawner(Spawner, endView.PipeEnd);
         }
     }
 }
Esempio n. 3
0
    public static void CreatePipeEnd(GameObject pipeEndPrefab, GameObject parent, GamePipeEnd pipeDef, GamePlumbingView gamePlumbingView)
    {
        GameObject pipeEndObj = Instantiate(pipeEndPrefab, pipeDef.Position, Quaternion.identity);

        pipeEndObj.transform.SetParent(parent.transform);
        GamePipeEndView component = pipeEndObj.AddComponent <GamePipeEndView>();

        component.gamePlumbingView = gamePlumbingView;
        component.PipeEnd          = pipeDef;
        component.InitPipeEnd();
    }
Esempio n. 4
0
    public GamePipeEndView FinishPipeDrag(PointerEventData eventData)
    {
        List <RaycastResult> results = new List <RaycastResult>();

        EventSystem.current.RaycastAll(eventData, results);
        GamePipeEndView pipeEndResult = null;

        foreach (RaycastResult result in results)
        {
            GamePipeEndView pipeEnd = result.gameObject.GetComponent <GamePipeEndView>();
            if (pipeEnd != null)
            {
                pipeEndResult = pipeEnd;
                break;
            }
        }
        if (gameObject.activeSelf)
        {
            StopPipeDrag();
        }
        return(pipeEndResult);
    }
    private void OnPipeEndAdded(GamePipeEnd pipeEnd)
    {
        GameObject prefab = GetPipeEndPrefab(pipeEnd.Type);

        GamePipeEndView.CreatePipeEnd(prefab, pipeEndParent, pipeEnd, gamePlumbingView);
    }