Ejemplo n.º 1
0
    /// <summary>
    /// Handle clicking on tokens
    /// </summary>
    public bool InputUpdate(Ray ray)
    {
        if (FindObjectOfType <ShadowPhaseManager>().doingShadowPhase)
        {
            return(false);
        }

        if (Physics.Raycast(ray, out RaycastHit hit))
        {
            Transform objectHit = hit.transform;
            if (objectHit.name == "Exploration Token")
            {
                var objs = FindObjectsOfType <SpawnMarker>();
                foreach (var ob in objs)
                {
                    if (ob.name.Contains("SPAWNMARKER"))
                    {
                        Destroy(ob.gameObject);
                    }
                    if (ob.name == "STARTMARKER")
                    {
                        ob.gameObject.SetActive(false);
                    }
                }

                Tile tile = objectHit.parent.GetComponent <Tile>();

                interactionManager.GetNewTextPanel().ShowQueryExploration((res) =>
                {
                    if (res.btn1)
                    {
                        ShowExplorationText(tile, () =>
                        {
                            tile.RemoveExplorationToken();
                            tile.Colorize();
                            tile.RevealInteractiveTokens();
                            //fire trigger on chapter exploration
                            triggerManager.FireTrigger(tile.chapter.exploreTrigger);
                            //fire trigger on tile exploration
                            triggerManager.FireTrigger(tile.hexTile.triggerName);
                            //objectHit.parent.GetComponent<Tile>().tileGroup.ExploreTile();
                        });
                    }
                });

                camControl.MoveTo(tile.centerPosition, .2f);
                return(true);
            }
            else if (objectHit.name.Contains("Token"))
            {
                camControl.MoveTo(objectHit.parent.GetComponent <Tile>().centerPosition, .2f);
                QueryTokenInteraction(objectHit);
                return(true);
            }
        }
        return(false);
    }
Ejemplo n.º 2
0
    public void StartNewGame()
    {
        if (!debug)
        {
            //only show intro text if it's not empty
            if (!string.IsNullOrEmpty(scenario.introBookData.pages[0]))
            {
                interactionManager.GetNewTextPanel().ShowOkContinue(scenario.introBookData.pages[0], ButtonIcon.Continue, () =>
                {
                    uiControl.interactable = true;

                    if (objectiveManager.Exists(scenario.objectiveName))
                    {
                        objectiveManager.TrySetFirstObjective(scenario.objectiveName, () =>
                        {
                            chapterManager.TryTriggerChapter("Start", true);
                        });
                    }
                    else
                    {
                        chapterManager.TryTriggerChapter("Start", true);
                    }

                    //fire any campaign triggers
                    if (Bootstrap.campaignState != null)
                    {
                        foreach (var t in Bootstrap.campaignState.campaignTriggerState)
                        {
                            triggerManager.FireTrigger(t);
                        }
                    }
                });
            }
            else
            {
                uiControl.interactable = true;

                if (objectiveManager.Exists(scenario.objectiveName))
                {
                    objectiveManager.TrySetFirstObjective(scenario.objectiveName, () =>
                    {
                        chapterManager.TryTriggerChapter("Start", true);
                    });
                }
                else
                {
                    chapterManager.TryTriggerChapter("Start", true);
                }

                //fire any campaign triggers
                if (Bootstrap.campaignState != null)
                {
                    foreach (var t in Bootstrap.campaignState.campaignTriggerState)
                    {
                        triggerManager.FireTrigger(t);
                    }
                }
            }
        }
        else
        {
            //debug quickstart a chapter:
            objectiveManager.DebugSetObjective(scenario.objectiveName);
            uiControl.interactable = true;
            chapterManager.TryTriggerChapter("Start", true);
        }
    }