예제 #1
0
    void Update()
    {
        //if (!EventSystem.current.IsPointerOverGameObject())
        //if (!Settings.IsPointerOverUIObject())
        if (Settings.instance.objectSelected)
        {
            HouseTransform = Settings.instance.House.transform;
            timeLeft      -= Time.deltaTime;
            center         = HouseTransform.GetComponent <Renderer>().bounds.center;

            if (timeLeft > 0)
            {
                Settings.instance.interactive = false;
                cam.transform.position        = Vector3.Lerp(cam.transform.position, new Vector3(center.x + 8, center.y + 2f, center.z), Speed * Time.deltaTime);
                cam.transform.LookAt(center);
                imageCompas.transform.eulerAngles = new Vector3(0, 0, cam.transform.eulerAngles.y - 105);
            }
            else
            {
                Settings.instance.objectSelected = false;
                Settings.instance.interactive    = true;
                timeLeft = 2f;
                Settings.instance.cameraOffset = cam.transform.position - center;
                boundsCenterY = center.y;// + 10f;
                imageCompas.transform.eulerAngles    = new Vector3(0, 0, cam.transform.eulerAngles.y - 105);
                Settings.instance.readyToOrbitRotate = true;
                Settings.instance.rotModeChanged     = true;
                //SwitchLights();
                Popup.transform.SetPositionAndRotation(new Vector3(Screen.width / 2, Screen.height / 2, 0), Quaternion.identity);
                Popup.SetActive(true);

                GameObject.FindGameObjectWithTag("VillaInfo").GetComponent <Text>().text = Flat.VillaInfo(Settings.instance.selectedVilla);

                HouseTransform.Find("Point").GetComponent <Canvas>().gameObject.SetActive(false);

                const string selectedColorHexAv   = "#26B4B74B";
                const string selectedColorHexRes  = "#62615F4B";
                const string selectedColorHexSold = "#B70F004B";
                string       selectedColorHex     = selectedColorHexAv;
                Color        selectedColor;

                switch (Settings.instance.selectedVilla.availability)
                {
                case Flat.Availability.Available:
                    selectedColorHex = selectedColorHexAv;
                    break;

                case Flat.Availability.Reserved:
                    selectedColorHex = selectedColorHexRes;
                    break;

                case Flat.Availability.Sold:
                    selectedColorHex = selectedColorHexSold;
                    break;
                }

                buttonVillaName.SetActive(true);

                if (ColorUtility.TryParseHtmlString(selectedColorHex, out selectedColor))
                {
                    buttonVillaName.GetComponent <Image>().color = selectedColor;
                }

                GameObject.FindGameObjectWithTag("VillaName").GetComponent <Text>().text = HouseTransform.name;
                GameObject buttonSend = GameObject.Find("ButtonSend");
                buttonSend.SetActive(false);
            }
        }
    }