Exemplo n.º 1
0
    private IEnumerator ScanRoutine()
    {
        narrator.Clear();
        Cursor cursor = unit.battle.SpawnCursor(unit.location, true);
        Result <Vector2Int> result = new Result <Vector2Int>();

        yield return(cursor.AwaitSelectionRoutine(result, _ => true, ScanAtRoutine));

        if (!result.canceled)
        {
            BattleEvent ev = unit.battle.map.GetEventAt <BattleEvent>(result.value);
            if (ev != null)
            {
                BattleUnit unit = ev.unit;
                yield return(PrepareTalkRoutine(unit));

                pc.GetComponent <CharaEvent>().FaceToward(unit.battler.GetComponent <MapEvent>());
                unit.battler.GetComponent <CharaEvent>().FaceToward(pc.GetComponent <MapEvent>());

                LuaScript script = new LuaScript(GetComponent <LuaContext>(), unit.unit.luaOnExamine);
                GetComponent <LuaContext>().SetGlobal("name", unit.ToString());
                yield return(script.RunRoutine());

                narrator.Log(unit.StatusString(), true);
            }
        }
        rightDisplayEnabled = false;
        unit.battle.DespawnCursor();
        executeResult.Cancel();
    }