Ejemplo n.º 1
0
    public void ActiveScriptGameWait()
    {
        if (IsScriptMainRunning)
        {
            return;
        }
        int mapIdx = AutoTileMap_Editor.Instance.MapIdxSelect;
        var script = GetRawScript(mapIdx, mIdxScriptWait);

        if (script == null)
        {
            return;
        }
        //Pause target
        ScriptGame s_from_npc = GetScriptGameCache_NPC_Begin(mTargetWait, false);

        AddScriptNeedResume(s_from_npc);
        //
        var target    = mTargetWait;
        var tdxScript = mIdxScriptWait;

        // Reset Wait
        mTargetWait    = null;
        mIdxScriptWait = -1;
        ResetObjInteraction();
        ResetLogChat();
        InputFieldHelper.Instance.Hide_Menu_BtTalk();
        ScriptMain = GetScriptGameCache_NPC_Ingame(target, true);
        ScriptMain.StartOnMain(mapIdx, tdxScript, script, target, (ScriptGame scriptGame) => {
            ResumeAndClearScriptWait();
            ClearNpcHasAdd();
            ScriptMain = null;
        });
    }
Ejemplo n.º 2
0
    public void OnScriptEnter(GameObject scriptTarget, int triggerRef)
    {
        if (IsScriptMainRunning || triggerRef < 0 || triggerRef >= AutoTileMap_Editor.Instance.MapSelect.ScriptData.Count)
        {
            return;
        }
        int mapIdx = AutoTileMap_Editor.Instance.MapIdxSelect;
        var script = GetRawScript(mapIdx, triggerRef);

        if (script == null)
        {
            return;
        }
        // Stop MainChar
        var nav = AutoTileMap_Editor.Instance.Agent.GetComponent <NavMeshAgentCallback>();

        nav.ResetPath();
        //
        ResetLogChat();
        ScriptMain = GetScriptGameCache_Script(scriptTarget, true);
        ScriptMain.StartOnMain(mapIdx, triggerRef, script, null, (ScriptGame scriptGame) => {
            ResumeAndClearScriptWait();
            ClearNpcHasAdd();
            ScriptMain = null;
        });
    }