Пример #1
0
        public void AwakeWheel(List <SelectionWheelNodeData> wheelNodeDatas, Transform followingWorldTransform)
        {
            if (!IsWheelEnabled)
            {
                IsWheelEnabled = true;
                this.followingWorldTransform = followingWorldTransform;

                var SelectionWheelGlobalConfiguration = SelectionWheelGlobalConfigurationGameObject.Get().SelectionWheelGlobalConfiguration;

                if (SelectionWheelGameObject == null)
                {
                    SelectionWheelGameObject      = new SelectionWheelGameObject(CoreGameSingletonInstances.GameCanvas);
                    SelectionWheelObjectAnimation = new SelectionWheelObjectAnimation(SelectionWheelGameObject, SelectionWheelGlobalConfiguration.SelectionWheelEnterAnimation, OnExitAnimationFinished);
                }

                SelectionWheelPositionManager = new SelectionWheelPositionManager(this, SelectionWheelGlobalConfiguration, this.followingWorldTransform);
                SelectionWheelObjectAnimation.PlayEnterAnimation();
                ActionWheelActiveNodeManager   = new ActionWheelActiveNodeManager(SelectionWheelGlobalConfiguration.NonSelectedMaterial, SelectionWheelGlobalConfiguration.SelectedMaterial);
                ActionWheelNodePositionManager = new ActionWheelNodePositionManager(SelectionWheelGlobalConfiguration.ActionWheelNodePositionManagerComponent, GameInputManager.Get(), ActionWheelActiveNodeManager);
                wheelNodes = new SelectionWheelNode[wheelNodeDatas.Count];
                for (var i = 0; i < wheelNodeDatas.Count; i++)
                {
                    var wheelNode = SelectionWheelNode.Instantiate(wheelNodeDatas[i]);
                    wheelNode.transform.SetParent(SelectionWheelGameObject.SelectionWheelNodeContainerGameObject.transform, false);
                    wheelNodes[i] = wheelNode;
                }

                ActionWheelNodePositionManager.InitNodes(wheelNodes);
                ActionWheelActiveNodeManager.SelectedNodeChanged(wheelNodes);
            }
        }
Пример #2
0
        public void SelectedNodeChanged(SelectionWheelNode[] wheelActionNodes)
        {
            if (activeNode != null)
            {
                activeNode.SetMaterial(nonSelectedMaterial);
                activeNode.SetActiveText(false);
            }

            for (var i = 0; i < wheelActionNodes.Length; i++)
            {
                if (wheelActionNodes[i].TargetWheelAngleDeg % 360 == 0)
                {
                    activeNode = wheelActionNodes[i];
                    activeNode.SetMaterial(selectedMaterial);
                    activeNode.SetActiveText(true);
                    return;
                }
            }
        }