Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        var sname = SceneSelector.GetCurrentSceneName();

        if (sname != null)
        {
            var laststage = StageAchievement.GetLastStageSceneName(sname);
            {
                if (laststage != null)
                {
                    foreach (Transform worldstage in transform)
                    {
                        var stageSelectable = worldstage.GetComponentInChildren <StageSelectable>();
                        var stage           = stageSelectable?.stage;
                        if (stage != null)
                        {
                            if (laststage == stage.sceneName)
                            {
                                current = stageSelectable;
                                current?.GetComponent <Selectable>()?.Select();
                                return;
                            }
                        }
                    }
                }
                if (transform.childCount > 0)
                {
                    var stageSelectable = transform.GetChild(0).GetComponentInChildren <StageSelectable>();
                    current = stageSelectable;
                    current?.GetComponent <Selectable>()?.Select();
                }
            }
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        var selectedObject = EventSystem.current.currentSelectedGameObject;

        if (selectedObject?.GetComponentInParent <SelectCurrent>() != this)
        {
            return;
        }
        bool changed = lastSelectable != selectedObject;

        lastSelectable = selectedObject;

        if (changed)
        {
            var stageSelectable = selectedObject?.GetComponentInChildren <StageSelectable>();
            if (stageSelectable != null)
            {
                if (stageSelectable.interactable)
                {
                    current = stageSelectable;
                }
                else
                {
                    current?.GetComponent <Selectable>()?.Select();
                }
            }
        }
    }
Пример #3
0
 void SetLineCleared(StageSelectable selectable, int clearLevel)
 {
     foreach (var line in selectable.GetComponentsInChildren <ConnectorBase>())
     {
         line.GetComponent <LineRenderer>().enabled = clearLevel > 0;
         if (line.connectionB != null && clearLevel > 0)
         {
             var linesel = line.connectionB.GetComponentInParent <StageSelectable>();
             if (linesel != null)
             {
                 linesel.interactable = true;
                 if (linesel.stage == null)
                 {
                     SetLineCleared(linesel, clearLevel);
                 }
             }
         }
     }
 }