Esempio n. 1
0
    public void Update()
    {
        selector.SetActive(false);

        if (rayCast.Hit())
        {
            if (rayCast.GetHit().transform.name == "MozartHausMenuButton")
            {
                selector.SetActive(true);
                selector.GetComponent <RectTransform>().anchoredPosition = MOZART_HAUS_MENU_BUTTON_POSITION;

                if (inputManager.IsTriggerClicked())
                {
                    TeleportToMozartHaus();
                }
            }
            else if (rayCast.GetHit().transform.name == "AppartementsMenuButton")
            {
                selector.SetActive(true);
                selector.GetComponent <RectTransform>().anchoredPosition = APPARTEMENTS_MENU_BUTTON_POSITION;

                //TODO implement function when IsTriggerClicked() == true
            }
            else if (rayCast.GetHit().transform.name == "ParametersMenuButton")
            {
                selector.SetActive(true);
                selector.GetComponent <RectTransform>().anchoredPosition = PARAMETERS_MENU_BUTTON_POSITION;

                //TODO: implement function when IsTriggerClicked() == true
            }
        }
    }
Esempio n. 2
0
    void Update()
    {
        if (inputManager.IsTriggerClicked() && rayCast.Hit() && canClick)
        {
            if (rayCast.GetHit().transform.name == "Save")
            {
                if (savingManager.GetCurrentSaveID().Length == 3)
                {
                    savingManager.UpdateCurrentSave();
                }
                else
                {
                    //TODO: Display Message
                }
                canClick = false;
            }
            else if (rayCast.GetHit().transform.name == "SaveAs")
            {
                IDSelectorUIHandler idSelectorUIHandler = transform.GetChild(0).Find("IDSelectorUI").GetComponent <IDSelectorUIHandler>();
                string saveID = idSelectorUIHandler.GetCurrentID();

                Debug.Log(saveID);
                // TODO: display override message
                savingManager.SaveGameObjects(saveID);

                canClick = false;
            }
        }
        if (!canClick)
        {
            canClick = !inputManager.IsTriggerClicked();
        }
    }
Esempio n. 3
0
 void Update()
 {
     if (rayCast.Hit())
     {
         laserLine.enabled = true;
         UpdateLaserPos(rayCast.GetHit());
         UpdateLaserColor();
     }
     else
     {
         laserLine.enabled = false;
     }
 }
    void Update()
    {
        if (inputManager.IsTriggerClicked() && canClick && rayCast.Hit())
        {
            if (rayCast.GetHit().transform.name == "Load")
            {
                savingManager.LoadGameObjects(idSelectorUIHandler.GetCurrentID()); // TODO: Use return to display fail or success message
                canClick = false;
            }
        }

        if (!canClick)
        {
            canClick = !inputManager.IsTriggerClicked();
        }
    }
Esempio n. 5
0
    void Update()
    {
        if (modHandler.IsInEditionMod() && rayCast.Hit())
        {
            if (inputManager.IsTriggerClicked() && canClick)
            {
                canClick = false;

                if (isOnDrag) // Place Game Object
                {
                    furnitureSelected.GetComponent <Collider>().enabled = true;
                    furnitureSelected = null;

                    isOnDrag = false;
                }
                else if (rayCast.HitFurniture() && !isClicked && !isOnDrag) // Select Game Object
                {
                    furnitureSelected = GameObject.Find(rayCast.GetHit().transform.name);
                    isClicked         = true;
                }
                else if (isClicked && !isOnDrag && !movableUIHandler.HitMovableUI()) // UnSelect Game Object
                {
                    DestroyMovableUI();

                    isClicked = false;
                }
            }
            if (isOnDrag) // Move Game Object
            {
                UpdateFurniturePosition(rayCast.GetHit());
                networkManager.SendFurniturePosUpdate(furnitureSelected);
            }

            if (!canClick)
            {
                canClick = !inputManager.IsTriggerClicked();
            }
        }
    }
    void Update()
    {
        if (dragFurniture.IsClicked())
        {
            Vector3 newpos        = dragFurniture.GetFurnitureSelected().transform.position;
            Vector3 difference    = (rayCast.source.transform.position - dragFurniture.GetFurnitureSelected().transform.position).normalized;
            Vector3 furnitureSize = dragFurniture.GetFurnitureSelected().GetComponent <Renderer>().bounds.size;

            if (furnitureSize.x > furnitureSize.z)
            {
                newpos = newpos + difference * (furnitureSize.x * 0.65f);
            }
            else
            {
                newpos = newpos + difference * (furnitureSize.z * 0.65f);
            }
            newpos.y = 0.5f;


            GetComponent <RectTransform>().anchoredPosition3D = newpos;

            Vector3 lookAt = rayCast.source.transform.position;
            lookAt.y = 1f;
            GetComponent <RectTransform>().LookAt(lookAt);
        }

        if (inputManager.IsTriggerClicked() && rayCast.Hit() && dragFurniture.CanClick())
        {
            if (HitMoveButton())
            {
                dragFurniture.MakeSelectedObjectMovable();
            }
            else if (HitRemoveButton())
            {
                dragFurniture.RemoveSelectedObject();
            }
        }
    }
    void Update()
    {
        if (inputManager.IsTriggerClicked() && rayCast.Hit() && canClick)
        {
            canClick = false;

            if (rayCast.GetHit().transform.name == "ButtonDown")
            {
                Text currentLetterSelector = rayCast.GetHit().transform.parent.Find("LetterView").GetComponentInChildren <Text>();
                currentLetterSelector.text = GetNextChar(currentLetterSelector.text[0]).ToString();
            }
            else if (rayCast.GetHit().transform.name == "ButtonUp")
            {
                Text currentLetterSelector = rayCast.GetHit().transform.parent.Find("LetterView").GetComponentInChildren <Text>();
                currentLetterSelector.text = GetPreviousChar(currentLetterSelector.text[0]).ToString();
            }
        }

        if (!canClick)
        {
            canClick = !inputManager.IsTriggerClicked();
        }
    }
Esempio n. 8
0
    private void Select()
    {
        if (!modHandler.IsInEditionMod() || !inputManager.IsTriggerClicked())
        {
            return;
        }

        if (!rayCast.Hit())
        {
            return;
        }

        canClick = false;
        Transform hitObject = rayCast.GetHit().transform;

        if (hitObject.parent == leftSide.transform)
        {
            UpdateRightUIPart(hitObject.GetSiblingIndex());
        }
        else if (hitObject.parent == rightSide.transform)
        {
            dragFurniture.SelectObject(GameObject.Find((rayCast.GetHit().transform.GetChild(0).GetComponent <Text>().text)));
        }
    }
 void Update()
 {
     if (inputManager.IsTriggerClicked() && canTeleport && modHandler.IsInUtilitiesMod() && rayCast.Hit())
     {
         Teleport(rayCast.GetHit());
         canTeleport = false;
     }
     else if (!canTeleport)
     {
         canTeleport = !inputManager.IsTriggerClicked();
     }
 }