Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 currentAngle = lookSquare.transform.position - cam.transform.position;



        float angle = Vector3.Angle(oldAngle, currentAngle);

        if (angle < angleDif)
        {
            if (percent < 100)
            {
                percent += sizeRate * Time.deltaTime;
                if (!initialized)
                {
                    setUPCircle.GetComponent <RectTransform>().localScale = Vector3.one * setUPcurve.Evaluate(percent / 100);
                }
            }
            else
            {
                if (!initialized)
                {
                    //targetPrefab.GetComponent<MeshRenderer>().enabled = true;
                    targetPrefab.GetComponent <Collider>().enabled = true;
                    targetPrefab.transform.position = this.transform.position;
                    // Debug.Log(this.transform.position);
                    //  anchor = targetPrefab.AddComponent<WorldAnchor>();
                    targetPlacedSound.Play();
                    initialized = true;
                    percent     = 0;

                    startLevel.StartLevel(20f);
                    setUPCircle.GetComponent <Image>().fillAmount = 0;
                    setupFocus.color = new Color(0, 0, 0, 0);
                    //  iTween.ValueTo(this.gameObject, iTween.Hash("from", 0.75f, "to", 0f, "delay", 0.5f, "time", 1.5, "onupdate", "updateColor", "easeType",iTween.EaseType.easeOutCubic));


                    // iTween.ScaleTo(setUPCircle, iTween.Hash("x", 0.2f, "y", 0.2f, "z", 0.2f, "time", 1.5, "delay", 0, "onupdate", "myUpdateFunction"));
                }
            }
        }
        else
        {
            percent = 0;
        }


        oldAngle = currentAngle;

        setUPCircle.transform.rotation = Quaternion.LookRotation(lookSquare.transform.position - cam.transform.position, cam.transform.up);
    }