Esempio n. 1
0
        protected virtual void Update()
        {
            inputManager.Update();

            AddToDelta();
            DampenDelta();
        }
        protected virtual void LateUpdate()
        {
            inputManager.Update();

            foreach (var finger in inputManager.Fingers)
            {
                if (finger.Down == true)
                {
                    Pick(finger.Position);
                }
            }

            var targetAlpha = 0.0f;

            if (FloatingCamera != null && WorldCamera != null)
            {
                if (CurrentTarget != null)
                {
                    var localPosition = FloatingCamera.CalculatePosition(ref CurrentTarget.CachedPoint.Position);
                    var screenPoint   = WorldCamera.WorldToScreenPoint(localPosition);

                    if (screenPoint.z >= 0.0f)
                    {
                        var anchoredPosition = default(Vector2);

                        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(Parent, screenPoint, null, out anchoredPosition) == true)
                        {
                            Rect.anchoredPosition = anchoredPosition;
                        }

                        targetAlpha = 1.0f;

                        if (HideIfTooClose == true)
                        {
                            if (SgtPosition.SqrDistance(ref SgtFloatingCamera.Instances.First.Value.Position, ref CurrentTarget.CachedPoint.Position) <= CurrentTarget.WarpDistance * CurrentTarget.WarpDistance)
                            {
                                targetAlpha = 0.0f;
                            }
                        }
                    }
                    else
                    {
                        Alpha = 0.0f;
                    }

                    Title.text = CurrentTarget.WarpName;
                }
            }

            var factor = SgtHelper.DampenFactor(10.0f, Time.deltaTime);

            Alpha = Mathf.Lerp(Alpha, targetAlpha, factor);

            Group.alpha          = Alpha;
            Group.blocksRaycasts = targetAlpha > 0.0f;
        }
        protected virtual void Update()
        {
            inputManager.Update();

            if (Target == null)
            {
                AddToDelta();
                DampenDelta();
            }
        }