Пример #1
0
 void Update()
 {
     if (animating)
     {
         time = Mathf.Clamp01(2f * Time.deltaTime + time);
         float val = Smoothing.QuinticEaseOut(time);
         val = val * xTarget + (1 - val) * xStart;
         uiTransform.RelativePosition = new Vector2(val, 0);
         if (time == 1)
         {
             animating = false;
             if (!activating)
             {
                 gameObject.SetActive(false);
             }
         }
     }
 }
Пример #2
0
    void Update()
    {
        if (activated)
        {
            if (entity == null)
            {
                entity = ItemManagement.Instance.GetItem(item);
                if (entity != null)
                {
                    DrawItem();
                }
            }
            else
            {
                UpdateScrollers();
                if (Input.GetKey(KeyCode.Mouse0))
                {
                    Ray        ray = customizerCamera.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;
                    if (Physics.Raycast(ray, out hit, 100))
                    {
                        string name = hit.collider.name;
                        for (int i = 0; i < entity.Parameters.Count; i++)
                        {
                            if (name == entity.Parameters[i].name)
                            {
                                if (i < 4)
                                {
                                    downParam = i;

                                    // hit.collider.gameObject.renderer.material.color = new Color(1,1,0.5f,1);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (downParam != -1)
                    {
                        selectedParameter = downParam;

                        if (currentObject != null)
                        {
                            SetObjectColors(currentObject.transform);
                        }
                        downParam = -1;
                    }
                }
                if (icon.Texture == null)
                {
                    icon.Texture = PhotoManager.Instance.GetImage(entity.Id);
                }
            }
        }
        if (animating)
        {
            time = Mathf.Clamp01(2f * Time.deltaTime + time);
            float val = Smoothing.QuinticEaseOut(time);
            val = val * xTarget + (1 - val) * xStart;
            uiTransform.RelativePosition = new Vector2(val, 0);
            //SetCameraX(Screen.width*val);
            if (time == 1)
            {
                animating = false;
                if (!activating)
                {
                    gameObject.SetActive(false);
                }
            }
        }
        pitch = Smoothing.SpringSmooth(pitch, targetPitch, ref pitchVelocity, 0.2f, Time.deltaTime);
        float tYaw = Mathf.DeltaAngle(yaw, targetYaw);

        yaw = Smoothing.SpringSmooth(yaw, targetYaw, ref yawVelocity, 0.2f, Time.deltaTime);
        cameraParent.rotation = Quaternion.AngleAxis(yaw, Vector3.up) * Quaternion.AngleAxis(pitch, Vector3.right);
    }