////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public void Awake()
 {
     if (Indicator == null)
     {
         Indicator = GetComponentInParent <HoverIndicator>();
     }
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public override void TreeUpdate()
        {
            HoverIndicator indic = GetComponent <HoverIndicator>();

            Controllers.Set(MasterAlphaName, this);
            MasterAlpha = Mathf.Pow(indic.HighlightProgress, 2);

            base.TreeUpdate();
        }
Beispiel #3
0
 public void turnOffUI()
 {
     if (RightIndexSelection != null)
     {
         HoverIndicator hi = RightIndexSelection.GetComponent <HoverIndicator>();
         if (hi.SelectionProgress < 0.05f)
         {
             RightIndexUI.SetActive(false);
         }
     }
 }
Beispiel #4
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateIndicator()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            HoverIndicator idleInd = GetComponent <HoverIndicator>();

            idleInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            idleInd.HighlightProgress = Mathf.Lerp(0.05f, 1, TimerProgress);
        }
Beispiel #5
0
        /*--------------------------------------------------------------------------------------------*/
        public virtual void TreeUpdate()
        {
            HoverItemRendererUpdater rendUp  = GetComponent <HoverItemRendererUpdater>();
            HoverIndicator           rendInd = rendUp.ActiveRenderer.GetIndicator();

            rendInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            rendInd.Controllers.Set(HoverIndicator.SelectionProgressName, this);

            rendInd.HighlightProgress = Mathf.Max(rendInd.HighlightProgress, MinHightlightProgress);
            rendInd.SelectionProgress = Mathf.Max(rendInd.SelectionProgress, MinSelectionProgress);

            Controllers.TryExpireControllers();
        }
Beispiel #6
0
    private void Start()
    {
        distanceIndicator = Prefabs.Instantiate <HoverIndicator>();
        distanceIndicator.transform.parent = transform;
        distanceIndicator.Initialize();
        distanceIndicator.SetSize(maxDistance);
        towerMesh   = GetComponentInChildren <TowerMesh>();
        firingTimer = firingInterval + 1f;

        setReferences(transform);

        origMaterial = towerTopRenderer.materials[1];
    }
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateRendererIndicator(HoverRenderer pRenderer,
                                             HoverItemHighlightState pHighState, HoverItemSelectionState pSelState)
        {
            HoverIndicator rendInd = pRenderer.GetIndicator();

            rendInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            rendInd.Controllers.Set(HoverIndicator.SelectionProgressName, this);

            rendInd.HighlightProgress = pHighState.MaxHighlightProgress;
            rendInd.SelectionProgress = pSelState.SelectionProgress;

            if (pSelState.WasSelectedThisFrame)
            {
                rendInd.LatestSelectionTime = DateTime.UtcNow;
            }
        }
Beispiel #8
0
        public override void _Ready()
        {
            base._Ready();
            hoverIndicator   = GetNode <HoverIndicator>(hoverIndicatorNodePath);
            treeActionRadius = GetNode <TreeActionRadius>(actionRadiusNodePath);
            stateMachine     = GetNode <TreeStateMachine>(stateMachineNodePath);
            treeState        = GetNode <TreeState>(treeStateNodePath);
            interactionPopup = interactionPopupPackedScene.Instance() as InteractionPopup;

            uiContainer = NodeGetter.GetFirstNodeInGroup <Control>(GetTree(), GameConstants.UiContainerGroup, true);

            soundEngineNode = NodeGetter.GetFirstNodeInGroup <SoundEngineNode>(GetTree(), GameConstants.SoundEngineGroup, true);

            uiContainer?.AddChild(interactionPopup);
            interactionPopup.Init(this);
            Connect("tree_exiting", this, nameof(OnTreeExiting));
        }
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateRenderer(HoverCursorFollower pFollower)
        {
            ICursorData    cursorData = pFollower.GetCursorData();
            HoverIndicator cursorInd  = CursorRenderer.GetIndicator();

            CursorRenderer.Controllers.Set(SettingsControllerMap.GameObjectActiveSelf, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.IsRaycastName, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.RaycastWorldOriginName, this);
            cursorInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            cursorInd.Controllers.Set(HoverIndicator.SelectionProgressName, this);

            RendererUtil.SetActiveWithUpdate(CursorRenderer, cursorData.IsActive);
            CursorRenderer.IsRaycast          = cursorData.IsRaycast;
            CursorRenderer.RaycastWorldOrigin = cursorData.WorldPosition;
            cursorInd.HighlightProgress       = cursorData.MaxItemHighlightProgress;
            cursorInd.SelectionProgress       = cursorData.MaxItemSelectionProgress;
        }
Beispiel #10
0
        /*--------------------------------------------------------------------------------------------*/
        protected float GetDimensionProgress(SizeType pType)
        {
            HoverIndicator ind = GetComponent <HoverIndicator>();

            switch (pType)
            {
            case SizeType.Min: return(0);

            case SizeType.Selection: return(ind.SelectionProgress);

            case SizeType.Highlight: return(ind.HighlightProgress);

            case SizeType.Max: return(1);
            }

            throw new Exception("Unexpected type: " + pType);
        }
Beispiel #11
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateRenderer(HoverCursorFollower pFollower)
        {
            ICursorData    cursorData = pFollower.GetCursorData();
            HoverIndicator cursorInd  = CursorRenderer.GetIndicator();

            CursorRenderer.Controllers.Set(SettingsControllerMap.GameObjectActiveSelf, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.IsRaycastName, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.ShowRaycastLineName, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.RaycastWorldOriginName, this);
            cursorInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            cursorInd.Controllers.Set(HoverIndicator.SelectionProgressName, this);

            RendererUtil.SetActiveWithUpdate(CursorRenderer,
                                             (cursorData.IsActive && cursorData.Capability != CursorCapabilityType.None));
            CursorRenderer.IsRaycast       = cursorData.IsRaycast;
            CursorRenderer.ShowRaycastLine = (cursorData.CanCauseSelections &&
                                              cursorData.Type != CursorType.Look);
            CursorRenderer.RaycastWorldOrigin = cursorData.WorldPosition;
            cursorInd.HighlightProgress       = cursorData.MaxItemHighlightProgress;
            cursorInd.SelectionProgress       = cursorData.MaxItemSelectionProgress;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateMeshes()
        {
            HoverFillButton fillButton = gameObject.GetComponent <HoverFillButton>();
            HoverShapeRect  shapeRect  = gameObject.GetComponent <HoverShapeRect>();

            float totalEdgeThick = EdgeThickness * 2;
            float insetSizeX     = Mathf.Max(0, shapeRect.SizeX - totalEdgeThick);
            float insetSizeY     = Mathf.Max(0, shapeRect.SizeY - totalEdgeThick);

            if (fillButton.Background != null)
            {
                UpdateMeshShape(fillButton.Background, insetSizeX, insetSizeY);
            }

            if (fillButton.Highlight != null)
            {
                UpdateMeshShape(fillButton.Highlight, insetSizeX, insetSizeY);
            }

            if (fillButton.Selection != null)
            {
                UpdateMeshShape(fillButton.Selection, insetSizeX, insetSizeY);
            }

            if (fillButton.Edge != null)
            {
                HoverIndicator meshInd = fillButton.Edge.GetComponent <HoverIndicator>();
                float          minSize = Mathf.Min(shapeRect.SizeX, shapeRect.SizeY);

                meshInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
                meshInd.HighlightProgress = 1 - totalEdgeThick / minSize;             //TODO:  hack/workaround

                UpdateMeshShape(fillButton.Edge,
                                shapeRect.SizeX, shapeRect.SizeY, fillButton.ShowEdge);
            }
        }
 public override void _Ready()
 {
     hoverIndicator = GetNode <HoverIndicator>(hoverIndicatorNodePath);
 }
Beispiel #14
0
        public bool isPanelSelected()
        {
            HoverIndicator hi = RightIndexSelection.GetComponent <HoverIndicator>();

            return(hi.SelectionProgress >= 0.8f);
        }
 public void Initialize()
 {
     hoverIndicator = Prefabs.Instantiate <HoverIndicator>();
     hoverIndicator.Initialize();
     hoverIndicator.transform.parent = transform;
 }