2026-11-18 07:46:32 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using TKS.OutGame;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using static TKS.ScenarioUi;
|
|
|
|
|
|
|
|
|
|
namespace TKS
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 시나리오 이벤트 연출(2026-11-18 PD 「연의전기의 각 시나리오 이벤트를 기획 및 제작 · 1장 도원결의부터」 · 요청서 `연의전기_이벤트_요청서.md` §4).
|
|
|
|
|
/// 표 = scenario_event.csv(한 줄 = 명령 하나 · s_event_id 묶음 · n_order 순 차례 실행) · 이름표 = scenario_actor.csv · 머리 위 표시 = scenario_emote.csv ·
|
|
|
|
|
/// 값 = scenario_event_config.csv(C45 · 코드에 값 없음) · 말풍선 = ScenarioUi.Say(보스 등장과 같은 PD 확정 시안).
|
|
|
|
|
/// 발동 = stage_start(판이 놓인 직후 · 학습 안내 전 · Setup = 조작 잠금) · win(승리 직후 · 결과·결말 카드 전) · 처음 깰 때만(다시 하기 = 건너뜀) · 가상 실행·연무장 모드 제외.
|
|
|
|
|
/// 배우 = slot<N>(학습 판 배치 표 n_slot) · 영웅 id(그 판의 아군·구출 대상) · extra 로 만든 이름(연출 전용 · 끝나면 사라짐).
|
|
|
|
|
/// 건너뛰기 = 남은 명령을 기다림 없이 끝 상태로 적용(자리 · 숨김 · 바닥 · 기절) → stage_start 는 끝에 판 유닛을 시작 자리·보임으로 되돌림(요청서 약속 3).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ScenarioEvent : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
static ScenarioEvent current;
|
|
|
|
|
|
|
|
|
|
/// <summary>연출 중인가(테스트·캡처 확인용).</summary>
|
|
|
|
|
public static bool Running
|
|
|
|
|
{
|
|
|
|
|
get { return current != null; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Actor
|
|
|
|
|
{
|
|
|
|
|
public string key;
|
|
|
|
|
public Unit unit;
|
|
|
|
|
public GameObject extra;
|
|
|
|
|
public FrameAnimator anim;
|
|
|
|
|
public SpriteRenderer shape;
|
|
|
|
|
public string name;
|
|
|
|
|
public Color tag;
|
|
|
|
|
|
|
|
|
|
public Vector2 Pos
|
|
|
|
|
{
|
|
|
|
|
get { return unit != null ? unit.Position : (Vector2)extra.transform.position; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (unit != null) unit.Position = value;
|
|
|
|
|
else extra.transform.position = new Vector3(value.x, value.y, 0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Vector2 Head
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (unit != null) return ScenarioUi.Head(unit);
|
|
|
|
|
return Pos + new Vector2(0f, anim != null ? anim.TopHeight : 0.8f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>쓰러뜨릴 그림(유닛 = 아트 묶음 · 도형 유닛 = View · 연출 인물 = 그림).</summary>
|
|
|
|
|
public Transform Body
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (unit != null) return unit.View == null ? unit.transform : (unit.View.Anim != null ? unit.View.Anim.transform : unit.View.transform);
|
|
|
|
|
return anim != null ? anim.transform : extra.transform;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GameObject Visual
|
|
|
|
|
{
|
|
|
|
|
get { return unit != null ? (unit.View != null ? unit.View.gameObject : unit.gameObject) : extra; }
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 11:16:09 +00:00
|
|
|
/// <summary>연출 안 방향 = 앞모습(아래 좌·우)만 — 가로 성분으로 좌우만 바꾼다(위로 걸어도 뒷모습으로 돌지 않음 · 뒷모습 = face 명령 back · 2026-11-18 PD).</summary>
|
2026-11-18 07:46:32 +00:00
|
|
|
public void Face(Vector2 dir)
|
|
|
|
|
{
|
|
|
|
|
if (unit != null)
|
|
|
|
|
{
|
2026-11-18 11:16:09 +00:00
|
|
|
if (unit.View != null) unit.View.SetFacing(new Vector2(Mathf.Abs(dir.x) > 0.01f ? Mathf.Sign(dir.x) : 0f, -1f));
|
2026-11-18 07:46:32 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (anim != null && Mathf.Abs(dir.x) > 0.01f) anim.Renderer.flipX = dir.x < 0f;
|
|
|
|
|
}
|
2026-11-18 11:16:09 +00:00
|
|
|
|
|
|
|
|
/// <summary>뒷모습(위 좌·우) — face 명령 s_arg back · back_left · back_right 만.</summary>
|
|
|
|
|
public void FaceBack(float x)
|
|
|
|
|
{
|
|
|
|
|
if (unit != null && unit.View != null) unit.View.SetFacing(new Vector2(x, 1f));
|
|
|
|
|
else if (anim != null && Mathf.Abs(x) > 0.01f) anim.Renderer.flipX = x < 0f;
|
|
|
|
|
}
|
2026-11-18 07:46:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BattleManager battle;
|
|
|
|
|
CameraController cc;
|
|
|
|
|
BalanceConfig.StageDef stage;
|
|
|
|
|
string trigger;
|
|
|
|
|
Action onDone;
|
|
|
|
|
List<List<ScenarioData.EventRow>> groups;
|
|
|
|
|
readonly TalkState st = new TalkState();
|
|
|
|
|
readonly Dictionary<string, Actor> actors = new Dictionary<string, Actor>();
|
|
|
|
|
readonly Dictionary<Unit, Vector2> startPos = new Dictionary<Unit, Vector2>();
|
|
|
|
|
// 기절 상태 = 연출 사이에 이어짐(stage_start 의 keep 기절 → 그 판 전투 동안 유지 → win 연출의 wake 가 풂) · 유닛이 사라지면 키가 null
|
|
|
|
|
static readonly Dictionary<Transform, Quaternion> fainted = new Dictionary<Transform, Quaternion>();
|
|
|
|
|
static readonly Dictionary<SpriteRenderer, Color> faintTint = new Dictionary<SpriteRenderer, Color>();
|
|
|
|
|
static readonly HashSet<Transform> faintKeep = new HashSet<Transform>();
|
|
|
|
|
readonly List<GameObject> temp = new List<GameObject>();
|
|
|
|
|
Vector3 camStart;
|
|
|
|
|
float viewStart;
|
|
|
|
|
|
|
|
|
|
RectTransform root, fx;
|
|
|
|
|
Image fade;
|
|
|
|
|
Image captionBand;
|
|
|
|
|
Text captionText;
|
|
|
|
|
Button skipBtn;
|
|
|
|
|
|
|
|
|
|
static readonly Color AllyTag = new Color(0.16f, 0.36f, 0.72f);
|
|
|
|
|
static readonly Color EnemyTag = new Color(0.75f, 0.16f, 0.12f);
|
|
|
|
|
static readonly Color ExtraTag = new Color(0.47f, 0.33f, 0.18f);
|
|
|
|
|
|
|
|
|
|
static float C(string k)
|
|
|
|
|
{
|
|
|
|
|
return ScenarioData.EvCfg(k);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool skip
|
|
|
|
|
{
|
|
|
|
|
get { return st.Skip; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>켜짐 규칙 = 학습 판과 같음(Auto = 메모리 세이브인 자동 테스트·검증 캡처에서는 꺼짐 · 1-1 을 일반 전투로 쓰는 기존 테스트 보호 · 연출 확인 = ForceOn).</summary>
|
|
|
|
|
public static TutorialMode Mode = TutorialMode.Auto;
|
|
|
|
|
|
|
|
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
|
|
|
static void ResetStatics()
|
|
|
|
|
{
|
|
|
|
|
Mode = TutorialMode.Auto;
|
|
|
|
|
current = null;
|
2026-11-18 08:50:23 +00:00
|
|
|
replayChapter = replayStage = 0;
|
2026-11-18 07:46:32 +00:00
|
|
|
fainted.Clear();
|
|
|
|
|
faintTint.Clear();
|
|
|
|
|
faintKeep.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool Enabled
|
|
|
|
|
{
|
|
|
|
|
get { return Mode == TutorialMode.ForceOn || (Mode == TutorialMode.Auto && !SaveStore.MemoryOnly); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>이 판 · 이 발동에 틀 연출이 있는가(켜짐 · 표 행 있음 · 처음 깸 · 가상 실행·연무장 아님 · slot 배우가 있으면 학습 판 배치가 켜져 있을 때만).</summary>
|
2026-11-18 08:50:23 +00:00
|
|
|
static int replayChapter, replayStage;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 다음에 이 판을 시작할 때 이미 깬 판이어도 연출을 다시 튼다(연의 전기 서장 「도원결의」 출전 = 이야기를 보러 들어옴 · 2026-11-18 PD 「결과물을 보고 피드백」).
|
|
|
|
|
/// 다른 판이 시작되면 풀린다.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void AllowReplay(int chapter, int stage)
|
|
|
|
|
{
|
|
|
|
|
replayChapter = chapter;
|
|
|
|
|
replayStage = stage;
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 11:16:09 +00:00
|
|
|
/// <summary>시나리오 표 열쇠 — 연의 모드 전투 = (편 id, 막) · 출정 = ("", 장, 판) · 그 밖 모드 = null(표 안 씀).</summary>
|
|
|
|
|
public static bool KeyOf(BattleManager bm, BalanceConfig.StageDef stage, out string battleId, out int chapter, out int st)
|
|
|
|
|
{
|
|
|
|
|
battleId = "";
|
|
|
|
|
chapter = stage != null ? stage.chapter : 0;
|
|
|
|
|
st = stage != null ? stage.stage : 0;
|
|
|
|
|
if (bm == null || stage == null) return false;
|
|
|
|
|
if (bm.Mode == null) return true;
|
|
|
|
|
var r = bm.Mode.rules;
|
|
|
|
|
if (r == null || string.IsNullOrEmpty(r.ScenarioBattleId)) return false;
|
|
|
|
|
battleId = r.ScenarioBattleId;
|
|
|
|
|
st = r.ScenarioAct;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static List<List<ScenarioData.EventRow>> GroupsFor(BattleManager bm, BalanceConfig.StageDef stage, string trigger, int turn)
|
|
|
|
|
{
|
|
|
|
|
string bid;
|
|
|
|
|
int ch, st;
|
|
|
|
|
if (!KeyOf(bm, stage, out bid, out ch, out st)) return new List<List<ScenarioData.EventRow>>();
|
|
|
|
|
return ScenarioData.Events(bid, ch, st, trigger, turn);
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 07:46:32 +00:00
|
|
|
public static bool Wants(BattleManager bm, BalanceConfig.StageDef stage, string trigger, bool cleared, int turn = 0)
|
|
|
|
|
{
|
2026-11-18 08:50:23 +00:00
|
|
|
if (stage != null && trigger == "stage_start" && (stage.chapter != replayChapter || stage.stage != replayStage)) replayChapter = replayStage = 0;
|
|
|
|
|
if (cleared && stage != null && stage.chapter == replayChapter && stage.stage == replayStage) cleared = false;
|
2026-11-18 11:16:09 +00:00
|
|
|
if (!Enabled || Sim.Active || bm == null || stage == null || cleared) return false;
|
|
|
|
|
var g = GroupsFor(bm, stage, trigger, turn);
|
2026-11-18 07:46:32 +00:00
|
|
|
if (g.Count == 0) return false;
|
|
|
|
|
foreach (var list in g)
|
|
|
|
|
foreach (var e in list)
|
|
|
|
|
if ((e.actor.StartsWith("slot") || e.target.StartsWith("slot")) && bm.Tutorial == null) return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Begin(BattleManager bm, BalanceConfig.StageDef stage, string trigger, Action onDone, int turn = 0)
|
|
|
|
|
{
|
|
|
|
|
Abort();
|
|
|
|
|
var cam = FindFirstObjectByType<CameraController>();
|
|
|
|
|
if (cam == null || cam.Cam == null)
|
|
|
|
|
{
|
|
|
|
|
onDone?.Invoke();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var go = new GameObject("ScenarioEventUI");
|
|
|
|
|
var ev = go.AddComponent<ScenarioEvent>();
|
|
|
|
|
current = ev;
|
|
|
|
|
ev.battle = bm;
|
|
|
|
|
ev.cc = cam;
|
|
|
|
|
ev.stage = stage;
|
|
|
|
|
ev.trigger = trigger;
|
|
|
|
|
ev.onDone = onDone;
|
2026-11-18 11:16:09 +00:00
|
|
|
ev.groups = GroupsFor(bm, stage, trigger, turn);
|
2026-11-18 07:46:32 +00:00
|
|
|
ev.Build();
|
|
|
|
|
ev.StartCoroutine(ev.Run());
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 11:16:09 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// 연의 전기 유닛 기본 방향 = 앞모습(아래)으로 판 가운데 쪽을 봄(가운데 왼쪽 = 오른쪽 아래 · 오른쪽 = 왼쪽 아래)
|
|
|
|
|
/// — 2026-11-18 PD 「연의 전기에서 유닛의 기본 방향은 좌/또는 우측 아래(윗 방향이면 뒷모습만 보여) · 뒷모습이 필요할 때만 위」.
|
|
|
|
|
/// 시나리오 이벤트 시작 · 연의 전기 전투 시작(ScenarioRules.OnBegin)에 부른다. 전투 중 이동 방향 규칙(PD #1082)은 그대로.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void FaceFrontAll(BattleManager bm)
|
|
|
|
|
{
|
|
|
|
|
if (bm == null || Sim.Active) return;
|
|
|
|
|
foreach (var f in new[] { Faction.Player, Faction.Enemy })
|
|
|
|
|
foreach (var u in bm.AliveUnits(f))
|
|
|
|
|
{
|
|
|
|
|
if (u.View == null) continue;
|
|
|
|
|
// 가장 가까운 상대편 쪽(가로) — 없으면 판 가운데 쪽 · 2026-11-18 PD 「장비가 적들을 바라보지 않고 엉뚱한 방향」
|
|
|
|
|
Unit near = null;
|
|
|
|
|
float best = float.MaxValue;
|
|
|
|
|
foreach (var o in bm.AliveUnits(f == Faction.Player ? Faction.Enemy : Faction.Player))
|
|
|
|
|
{
|
|
|
|
|
float dd = (o.Position - u.Position).sqrMagnitude;
|
|
|
|
|
if (dd < best) { best = dd; near = o; }
|
|
|
|
|
}
|
|
|
|
|
float dx = near != null ? near.Position.x - u.Position.x : -u.Position.x;
|
|
|
|
|
u.View.SetFacing(new Vector2(Mathf.Abs(dx) > 0.05f ? Mathf.Sign(dx) : (u.View.FacingLeft ? -1f : 1f), -1f));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Actor lastSpeaker;
|
|
|
|
|
|
|
|
|
|
/// <summary>말할 때 = 화자와 앞 화자가 서로 마주 봄(앞모습 · 가로만) · 앞 화자가 없으면 가장 가까운 상대편 쪽.</summary>
|
|
|
|
|
void FaceTalk(Actor a)
|
|
|
|
|
{
|
|
|
|
|
if (a == null) return;
|
|
|
|
|
var other = lastSpeaker != null && lastSpeaker != a && lastSpeaker.Visual != null && lastSpeaker.Visual.activeInHierarchy ? lastSpeaker : null;
|
|
|
|
|
if (other != null)
|
|
|
|
|
{
|
|
|
|
|
float dx = other.Pos.x - a.Pos.x;
|
|
|
|
|
if (Mathf.Abs(dx) > 0.05f)
|
|
|
|
|
{
|
|
|
|
|
a.Face(new Vector2(dx, 0f));
|
|
|
|
|
other.Face(new Vector2(-dx, 0f));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (a.unit != null)
|
|
|
|
|
{
|
|
|
|
|
Unit near = null;
|
|
|
|
|
float best = float.MaxValue;
|
|
|
|
|
foreach (var o in battle.AliveUnits(a.unit.Faction == Faction.Player ? Faction.Enemy : Faction.Player))
|
|
|
|
|
{
|
|
|
|
|
float dd = (o.Position - a.Pos).sqrMagnitude;
|
|
|
|
|
if (dd < best) { best = dd; near = o; }
|
|
|
|
|
}
|
|
|
|
|
if (near != null && Mathf.Abs(near.Position.x - a.Pos.x) > 0.05f) a.Face(new Vector2(near.Position.x - a.Pos.x, 0f));
|
|
|
|
|
}
|
|
|
|
|
lastSpeaker = a;
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-18 07:46:32 +00:00
|
|
|
/// <summary>지금 실행 중인 줄(테스트·캡처 확인용 · 끝나면 int.MaxValue).</summary>
|
|
|
|
|
public static string CurrentId = "";
|
|
|
|
|
public static int CurrentOrder;
|
|
|
|
|
|
|
|
|
|
/// <summary>테스트·캡처: 화면 누름 1회.</summary>
|
|
|
|
|
public static void TapForTest()
|
|
|
|
|
{
|
|
|
|
|
if (current != null) current.st.Taps++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>테스트: 건너뛰기 버튼.</summary>
|
|
|
|
|
public static void SkipForTest()
|
|
|
|
|
{
|
|
|
|
|
if (current != null) current.st.Skip = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>진행 중 연출을 바로 치움(전투 재시작 · 월드맵 복귀).</summary>
|
|
|
|
|
public static void Abort()
|
|
|
|
|
{
|
|
|
|
|
if (current == null) return;
|
|
|
|
|
current.Cleanup(false);
|
|
|
|
|
Destroy(current.gameObject);
|
|
|
|
|
current = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------- 화면 ----------
|
|
|
|
|
|
|
|
|
|
void Build()
|
|
|
|
|
{
|
|
|
|
|
UiLayer.Root(gameObject, cc.Cam, 460, 0.38f, UiLayer.Reference, UiRate.Event);
|
|
|
|
|
root = (RectTransform)transform;
|
|
|
|
|
var catcher = Full("Tap", root, null, new Color(0f, 0f, 0f, 0f));
|
|
|
|
|
catcher.raycastTarget = true;
|
|
|
|
|
catcher.gameObject.AddComponent<Button>().onClick.AddListener(() => st.Taps++);
|
|
|
|
|
fx = UiLayer.Group("Fx", root, UiRate.Frame);
|
|
|
|
|
fade = Full("Fade", fx, null, new Color(0f, 0f, 0f, 0f));
|
|
|
|
|
// 위아래 검은 띠(연출 화면 · 재화 바·전투 HUD 를 가림 · 보스 등장과 같은 방식)
|
|
|
|
|
float bar = UiLayer.Reference.y * C("letterbox_ratio");
|
|
|
|
|
Img("BarTop", fx, null, Color.black, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(0f, bar));
|
|
|
|
|
Img("BarBottom", fx, null, Color.black, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(0f, bar));
|
|
|
|
|
float bandH = C("caption_band_height");
|
|
|
|
|
captionBand = Img("Caption", fx, null, new Color(0f, 0f, 0f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -C("caption_band_top")), new Vector2(0f, bandH));
|
|
|
|
|
captionText = Txt(captionBand.transform, "", Mathf.RoundToInt(C("caption_font_size")), new Color(1f, 0.95f, 0.85f, 0f), TextAnchor.MiddleCenter, Vector2.zero, new Vector2(UiLayer.Reference.x - 80f, bandH), UISkin.TitleFont);
|
|
|
|
|
var sb = Img("Skip", root, null, new Color(0f, 0f, 0f, 0.6f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-40f, -60f), new Vector2(190f, 80f));
|
|
|
|
|
sb.raycastTarget = true;
|
|
|
|
|
skipBtn = sb.gameObject.AddComponent<Button>();
|
|
|
|
|
skipBtn.onClick.AddListener(() => st.Skip = true);
|
|
|
|
|
Txt(sb.transform, "건너뛰기 >>", 34, Color.white, TextAnchor.MiddleCenter, Vector2.zero, new Vector2(190f, 80f), UISkin.TitleFont);
|
|
|
|
|
sb.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------- 흐름 ----------
|
|
|
|
|
|
|
|
|
|
readonly List<Canvas> hudHidden = new List<Canvas>();
|
|
|
|
|
|
|
|
|
|
/// <summary>연출 동안 전투 HUD(안내 줄 · 아래 패널 · 작은 지도)를 그리지 않음 — 끝나면 되돌림.</summary>
|
|
|
|
|
void HideHud(bool hide)
|
|
|
|
|
{
|
|
|
|
|
if (hide)
|
|
|
|
|
{
|
|
|
|
|
var hud = FindFirstObjectByType<BattleHUD>();
|
|
|
|
|
if (hud == null) return;
|
|
|
|
|
foreach (var c in hud.GetComponentsInChildren<Canvas>())
|
|
|
|
|
if (c.enabled)
|
|
|
|
|
{
|
|
|
|
|
c.enabled = false;
|
|
|
|
|
hudHidden.Add(c);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
foreach (var c in hudHidden)
|
|
|
|
|
if (c != null) c.enabled = true;
|
|
|
|
|
hudHidden.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Run()
|
|
|
|
|
{
|
|
|
|
|
camStart = cc.transform.position;
|
|
|
|
|
viewStart = cc.ViewHeight;
|
|
|
|
|
HideHud(true);
|
|
|
|
|
foreach (var u in battle.AliveUnits(Faction.Player)) startPos[u] = u.Position;
|
|
|
|
|
foreach (var u in battle.AliveUnits(Faction.Enemy)) startPos[u] = u.Position;
|
2026-11-18 11:16:09 +00:00
|
|
|
FaceFrontAll(battle);
|
2026-11-18 07:46:32 +00:00
|
|
|
StartCoroutine(SkipButtonLater());
|
|
|
|
|
foreach (var list in groups)
|
|
|
|
|
foreach (var e in list)
|
|
|
|
|
{
|
|
|
|
|
CurrentId = e.id;
|
|
|
|
|
CurrentOrder = e.order;
|
|
|
|
|
yield return Do(e);
|
|
|
|
|
}
|
|
|
|
|
CurrentOrder = int.MaxValue;
|
|
|
|
|
yield return Return();
|
|
|
|
|
Cleanup(true);
|
|
|
|
|
var done = onDone;
|
|
|
|
|
onDone = null;
|
|
|
|
|
if (current == this) current = null;
|
|
|
|
|
Destroy(gameObject);
|
|
|
|
|
done?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator SkipButtonLater()
|
|
|
|
|
{
|
|
|
|
|
float t = 0f, show = C("skip_show_after_sec");
|
|
|
|
|
while (t < show) { t += Time.unscaledDeltaTime; yield return null; }
|
|
|
|
|
if (skipBtn != null) skipBtn.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float Sec(ScenarioData.EventRow e, string key)
|
|
|
|
|
{
|
|
|
|
|
return float.IsNaN(e.sec) ? C(key) : Mathf.Max(0f, e.sec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Do(ScenarioData.EventRow e)
|
|
|
|
|
{
|
|
|
|
|
switch (e.cmd)
|
|
|
|
|
{
|
|
|
|
|
case "fade": yield return Fade(e.arg == "out", Sec(e, "fade_sec")); break;
|
|
|
|
|
case "caption": yield return Caption(e.text, Sec(e, "caption_sec")); break;
|
2026-11-18 11:16:09 +00:00
|
|
|
case "bg":
|
|
|
|
|
if (battle.Board != null && battle.Board.SetEventArt(e.arg) && e.arg != ScenarioProps.StageBg) ScenarioProps.Clear(); // 다른 장소로 바뀜 = 이 판 소품 치움(3막 → 복숭아 동산)
|
|
|
|
|
break;
|
2026-11-18 07:46:32 +00:00
|
|
|
case "hide": yield return Show(Get(e.actor), false, e, Sec(e, "show_sec")); break;
|
|
|
|
|
case "show": yield return Show(Get(e.actor), true, e, Sec(e, "show_sec")); break;
|
|
|
|
|
case "extra": MakeExtra(e); break;
|
|
|
|
|
case "move": yield return Move(Get(e.actor), e); break;
|
|
|
|
|
case "face":
|
|
|
|
|
{
|
|
|
|
|
var a = Get(e.actor);
|
2026-11-18 11:16:09 +00:00
|
|
|
if (a == null) break;
|
|
|
|
|
bool left = e.arg == "left" || e.arg == "back_left";
|
|
|
|
|
if (e.arg == "back" || e.arg == "back_left" || e.arg == "back_right") a.FaceBack(e.arg == "back" ? 0f : (left ? -1f : 1f));
|
|
|
|
|
else a.Face(new Vector2(left ? -1f : 1f, 0f));
|
2026-11-18 07:46:32 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "say":
|
|
|
|
|
{
|
|
|
|
|
var a = Get(e.actor);
|
2026-11-18 11:16:09 +00:00
|
|
|
FaceTalk(a);
|
2026-11-18 07:46:32 +00:00
|
|
|
if (a != null && !skip) yield return Say(fx, root, cc.Cam, () => a.Head, a.name, a.tag, e.text, st);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "emote": yield return EmoteAt(Get(e.actor), e.arg, false); break;
|
|
|
|
|
case "focus": yield return Focus(e); break;
|
|
|
|
|
case "attack": yield return Attack(Get(e.actor), Get(e.target), Sec(e, "attack_sec")); break;
|
|
|
|
|
case "hit":
|
|
|
|
|
{
|
|
|
|
|
var a = Get(string.IsNullOrEmpty(e.target) ? e.actor : e.target);
|
|
|
|
|
if (a != null && !skip)
|
|
|
|
|
{
|
|
|
|
|
if (a.unit != null && a.unit.View != null) a.unit.View.OnHit();
|
|
|
|
|
yield return Wait(C("hit_sec"));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "faint": Faint(Get(e.actor), true, e.arg == "keep"); if (!skip) yield return Wait(C("faint_sec")); break;
|
|
|
|
|
case "wake": Faint(Get(e.actor), false, false); break;
|
|
|
|
|
case "shake":
|
|
|
|
|
if (!skip)
|
|
|
|
|
{
|
|
|
|
|
float k = string.IsNullOrEmpty(e.arg) ? 1f : Num(e.arg, 1f);
|
|
|
|
|
cc.Shake(Sec(e, "shake_sec"), C("shake_base") * k);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "wait": yield return Wait(Sec(e, "wait_sec")); break;
|
|
|
|
|
case "tap":
|
|
|
|
|
st.Taps = 0;
|
|
|
|
|
while (!skip && st.Taps == 0) yield return null;
|
|
|
|
|
st.Taps = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static float Num(string s, float def)
|
|
|
|
|
{
|
|
|
|
|
float v;
|
|
|
|
|
return float.TryParse(s, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out v) ? v : def;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------- 배우 ----------
|
|
|
|
|
|
|
|
|
|
Actor Get(string key)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(key)) return null;
|
|
|
|
|
Actor a;
|
|
|
|
|
if (actors.TryGetValue(key, out a)) return a;
|
|
|
|
|
Unit u = null;
|
|
|
|
|
if (key.StartsWith("slot"))
|
|
|
|
|
{
|
|
|
|
|
int slot;
|
|
|
|
|
if (battle.Tutorial != null && int.TryParse(key.Substring(4), out slot)) u = battle.Tutorial.UnitAt(slot);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (var f in new[] { Faction.Player, Faction.Enemy })
|
|
|
|
|
foreach (var x in battle.AliveUnits(f))
|
|
|
|
|
if (u == null && (x.HeroId == key || x.ArtId == key)) u = x;
|
|
|
|
|
}
|
|
|
|
|
if (u == null)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("[TKS] 시나리오 이벤트: 배우 없음 " + key + " (" + stage.chapter + "-" + stage.stage + ")");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
string nm = ScenarioData.ActorName(stage.chapter, stage.stage, key);
|
|
|
|
|
a = new Actor { key = key, unit = u, name = nm.Length > 0 ? nm : u.DisplayName, tag = u.Faction == Faction.Enemy ? EnemyTag : AllyTag };
|
|
|
|
|
actors[key] = a;
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeExtra(ScenarioData.EventRow e)
|
|
|
|
|
{
|
|
|
|
|
var go = new GameObject("Ev_" + e.actor);
|
|
|
|
|
temp.Add(go);
|
|
|
|
|
var pos = e.HasPos ? new Vector2(e.x, e.y) : Vector2.zero;
|
|
|
|
|
go.transform.position = new Vector3(pos.x, pos.y, 0f);
|
|
|
|
|
var a = new Actor { key = e.actor, extra = go, tag = ExtraTag };
|
|
|
|
|
string nm = ScenarioData.ActorName(stage.chapter, stage.stage, e.actor);
|
|
|
|
|
a.name = nm.Length > 0 ? nm : e.actor;
|
|
|
|
|
var art = UnitArt.Load(e.arg);
|
|
|
|
|
if (art != null)
|
|
|
|
|
{
|
|
|
|
|
var ago = new GameObject("Art");
|
|
|
|
|
ago.transform.SetParent(go.transform, false);
|
|
|
|
|
a.anim = ago.AddComponent<FrameAnimator>();
|
|
|
|
|
a.anim.Setup(art, battle.Config.unitArtHeight, 0, battle.Config.mountedArtMaxTop);
|
|
|
|
|
a.anim.SetIdle("front_idle");
|
|
|
|
|
a.anim.PlayIdle();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("[TKS] 시나리오 이벤트: 그림 없음 " + e.arg + " → 도형");
|
|
|
|
|
a.shape = ProceduralSprites.NewSprite(go.transform, "Body", ProceduralSprites.Circle, ExtraTag, C("extra_shape_size"), 0);
|
|
|
|
|
}
|
|
|
|
|
actors[e.actor] = a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Show(Actor a, bool on, ScenarioData.EventRow e, float dur)
|
|
|
|
|
{
|
|
|
|
|
if (a == null) yield break;
|
|
|
|
|
if (on && e.HasPos) a.Pos = new Vector2(e.x, e.y);
|
|
|
|
|
var vis = a.Visual;
|
|
|
|
|
if (vis == null) yield break;
|
|
|
|
|
var rends = vis.GetComponentsInChildren<SpriteRenderer>(true);
|
|
|
|
|
if (on) vis.SetActive(true);
|
|
|
|
|
if (dur > 0f && !skip)
|
|
|
|
|
{
|
|
|
|
|
var baseA = new float[rends.Length];
|
|
|
|
|
for (int i = 0; i < rends.Length; i++) baseA[i] = rends[i].color.a;
|
|
|
|
|
for (float t = 0f; t < dur && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
float k = on ? t / dur : 1f - t / dur;
|
|
|
|
|
for (int i = 0; i < rends.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var c = rends[i].color;
|
|
|
|
|
rends[i].color = new Color(c.r, c.g, c.b, baseA[i] * k);
|
|
|
|
|
}
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < rends.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var c = rends[i].color;
|
|
|
|
|
rends[i].color = new Color(c.r, c.g, c.b, baseA[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!on) vis.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Move(Actor a, ScenarioData.EventRow e)
|
|
|
|
|
{
|
|
|
|
|
if (a == null || !e.HasPos) yield break;
|
|
|
|
|
Vector2 p0 = a.Pos, p1 = new Vector2(e.x, e.y);
|
|
|
|
|
var d = p1 - p0;
|
|
|
|
|
if (d.sqrMagnitude > 0.0001f) a.Face(d);
|
|
|
|
|
float dur = float.IsNaN(e.sec) ? d.magnitude / Mathf.Max(0.01f, C("move_speed")) : Mathf.Max(0f, e.sec);
|
|
|
|
|
for (float t = 0f; t < dur && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
a.Pos = Vector2.Lerp(p0, p1, Ease(t / dur));
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
a.Pos = p1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Attack(Actor a, Actor b, float dur)
|
|
|
|
|
{
|
|
|
|
|
if (a == null || b == null || skip) yield break;
|
|
|
|
|
Vector2 p0 = a.Pos;
|
|
|
|
|
var d = b.Pos - p0;
|
|
|
|
|
float reach = (a.unit != null ? a.unit.Radius : 0.4f) + (b.unit != null ? b.unit.Radius : 0.4f);
|
|
|
|
|
Vector2 hitAt = d.magnitude > reach ? b.Pos - d.normalized * reach * C("attack_reach_ratio") : p0;
|
|
|
|
|
a.Face(d);
|
|
|
|
|
if (a.unit != null && a.unit.View != null) a.unit.View.PlayAttack();
|
|
|
|
|
float go = dur * C("attack_dash_ratio");
|
|
|
|
|
for (float t = 0f; t < go && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
a.Pos = Vector2.Lerp(p0, hitAt, Ease(t / go));
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
a.Pos = hitAt;
|
|
|
|
|
yield return Wait(dur - go * 2f);
|
|
|
|
|
for (float t = 0f; t < go && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
a.Pos = Vector2.Lerp(hitAt, p0, Ease(t / go));
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
a.Pos = p0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Faint(Actor a, bool on, bool keep)
|
|
|
|
|
{
|
|
|
|
|
if (a == null) return;
|
|
|
|
|
var body = a.Body;
|
|
|
|
|
if (on)
|
|
|
|
|
{
|
|
|
|
|
if (!fainted.ContainsKey(body)) fainted[body] = body.localRotation;
|
|
|
|
|
body.localRotation = Quaternion.Euler(0f, 0f, C("faint_angle"));
|
|
|
|
|
float dark = C("faint_dark");
|
|
|
|
|
foreach (var sr in body.GetComponentsInChildren<SpriteRenderer>())
|
|
|
|
|
{
|
|
|
|
|
if (faintTint.ContainsKey(sr)) continue;
|
|
|
|
|
faintTint[sr] = sr.color;
|
|
|
|
|
var c = sr.color;
|
|
|
|
|
sr.color = new Color(c.r * (1f - dark), c.g * (1f - dark), c.b * (1f - dark), c.a);
|
|
|
|
|
}
|
|
|
|
|
if (keep) faintKeep.Add(body);
|
|
|
|
|
var stars = Glyph(a, "dizzy", true);
|
|
|
|
|
if (stars != null)
|
|
|
|
|
{
|
|
|
|
|
stars.name = "FaintStars";
|
|
|
|
|
if (!keep) temp.Add(stars);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Unfaint(body);
|
|
|
|
|
var holder = a.unit != null ? a.unit.transform : a.extra.transform;
|
|
|
|
|
var old = holder.Find("FaintStars");
|
|
|
|
|
if (old != null) Destroy(old.gameObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Unfaint(Transform body)
|
|
|
|
|
{
|
|
|
|
|
Quaternion r;
|
|
|
|
|
if (fainted.TryGetValue(body, out r)) body.localRotation = r;
|
|
|
|
|
fainted.Remove(body);
|
|
|
|
|
faintKeep.Remove(body);
|
|
|
|
|
var keys = new List<SpriteRenderer>(faintTint.Keys);
|
|
|
|
|
foreach (var sr in keys)
|
|
|
|
|
{
|
|
|
|
|
if (sr == null)
|
|
|
|
|
{
|
|
|
|
|
faintTint.Remove(sr);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (!sr.transform.IsChildOf(body)) continue;
|
|
|
|
|
sr.color = faintTint[sr];
|
|
|
|
|
faintTint.Remove(sr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------- 머리 위 표시 ----------
|
|
|
|
|
|
|
|
|
|
GameObject Glyph(Actor a, string id, bool persistent)
|
|
|
|
|
{
|
|
|
|
|
var em = ScenarioData.EmoteOf(id);
|
|
|
|
|
if (a == null || em == null) return null;
|
|
|
|
|
var parent = a.unit != null ? a.unit.transform : a.extra.transform;
|
|
|
|
|
var tm = TextUtil.CreateWorldText(parent, em.glyph, C("emote_world_height"), em.color, 6);
|
|
|
|
|
tm.transform.position = (Vector3)(a.Head + new Vector2(0f, C("emote_offset"))) + new Vector3(0f, 0f, 0f);
|
|
|
|
|
if (!persistent) temp.Add(tm.gameObject);
|
|
|
|
|
return tm.gameObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator EmoteAt(Actor a, string id, bool persistent)
|
|
|
|
|
{
|
|
|
|
|
if (a == null || skip) yield break;
|
|
|
|
|
var g = Glyph(a, id, persistent);
|
|
|
|
|
if (g == null) yield break;
|
|
|
|
|
StartCoroutine(EmoteLife(g, C("emote_sec")));
|
|
|
|
|
yield return Wait(C("emote_wait_sec"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator EmoteLife(GameObject g, float life)
|
|
|
|
|
{
|
|
|
|
|
var p0 = g.transform.localPosition;
|
|
|
|
|
float hop = C("emote_hop");
|
|
|
|
|
for (float t = 0f; t < life && g != null; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
g.transform.localPosition = p0 + new Vector3(0f, hop * Mathf.Sin(Mathf.Clamp01(t / 0.25f) * Mathf.PI), 0f);
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
if (g != null) Destroy(g);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------- 카메라 · 화면 ----------
|
|
|
|
|
|
|
|
|
|
IEnumerator Focus(ScenarioData.EventRow e)
|
|
|
|
|
{
|
|
|
|
|
Vector2 target;
|
|
|
|
|
var a = Get(e.actor);
|
|
|
|
|
if (a != null) target = a.Pos;
|
|
|
|
|
else if (e.HasPos) target = new Vector2(e.x, e.y);
|
|
|
|
|
else target = camStart;
|
|
|
|
|
float zoom = string.IsNullOrEmpty(e.arg) ? 1f : Mathf.Max(0.1f, Num(e.arg, 1f));
|
|
|
|
|
float h1 = viewStart / zoom;
|
|
|
|
|
float dur = Sec(e, "focus_sec");
|
|
|
|
|
Vector2 p0 = cc.transform.position;
|
|
|
|
|
float h0 = cc.ViewHeight;
|
|
|
|
|
for (float t = 0f; t < dur && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
float k = Ease(t / dur);
|
|
|
|
|
cc.SetViewHeight(Mathf.Lerp(h0, h1, k));
|
|
|
|
|
cc.SnapTo(Vector2.Lerp(p0, target, k));
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
cc.SetViewHeight(h1);
|
|
|
|
|
cc.SnapTo(target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Fade(bool toBlack, float dur)
|
|
|
|
|
{
|
|
|
|
|
float a0 = fade.color.a, a1 = toBlack ? 1f : 0f;
|
|
|
|
|
for (float t = 0f; t < dur && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
fade.color = new Color(0f, 0f, 0f, Mathf.Lerp(a0, a1, t / dur));
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
fade.color = new Color(0f, 0f, 0f, skip ? 0f : a1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Caption(string text, float hold)
|
|
|
|
|
{
|
|
|
|
|
if (skip) yield break;
|
|
|
|
|
captionText.text = text;
|
|
|
|
|
float fIn = C("caption_fade_sec"), bandA = C("caption_band_alpha");
|
|
|
|
|
for (float t = 0f; t < fIn && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
SetCaption(bandA, t / fIn);
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
SetCaption(bandA, 1f);
|
|
|
|
|
st.Taps = 0;
|
|
|
|
|
for (float t = 0f; t < hold && !skip && st.Taps == 0; t += Time.unscaledDeltaTime) yield return null;
|
|
|
|
|
st.Taps = 0;
|
|
|
|
|
for (float t = 0f; t < fIn && !skip; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
SetCaption(bandA, 1f - t / fIn);
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
SetCaption(bandA, 0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetCaption(float bandA, float k)
|
|
|
|
|
{
|
|
|
|
|
captionBand.color = new Color(0f, 0f, 0f, bandA * k);
|
|
|
|
|
var c = captionText.color;
|
|
|
|
|
captionText.color = new Color(c.r, c.g, c.b, k);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Wait(float sec)
|
|
|
|
|
{
|
|
|
|
|
for (float t = 0f; t < sec && !skip; t += Time.unscaledDeltaTime) yield return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>카메라를 판 기본 화면으로 · 검은 덮개 걷기.</summary>
|
|
|
|
|
IEnumerator Return()
|
|
|
|
|
{
|
|
|
|
|
float dur = skip ? 0f : C("return_sec");
|
|
|
|
|
Vector2 p0 = cc.transform.position;
|
|
|
|
|
float h0 = cc.ViewHeight, a0 = fade.color.a;
|
|
|
|
|
bool keepBlack = trigger == "win" && a0 > 0.5f; // 승리 연출이 검게 끝나면 결과 화면 전까지 검게
|
|
|
|
|
for (float t = 0f; t < dur; t += Time.unscaledDeltaTime)
|
|
|
|
|
{
|
|
|
|
|
float k = Ease(t / dur);
|
|
|
|
|
cc.SetViewHeight(Mathf.Lerp(h0, viewStart, k));
|
|
|
|
|
cc.SnapTo(Vector2.Lerp(p0, camStart, k));
|
|
|
|
|
if (!keepBlack) fade.color = new Color(0f, 0f, 0f, a0 * (1f - k));
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
cc.SetViewHeight(viewStart);
|
|
|
|
|
cc.SnapTo(camStart);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>연출이 남긴 것 치우기 — 연출 인물 · 표시 · (keep 아닌) 기절 · stage_start 면 판 유닛을 시작 자리·보임으로(요청서 약속 3).</summary>
|
|
|
|
|
void Cleanup(bool finished)
|
|
|
|
|
{
|
|
|
|
|
HideHud(false);
|
|
|
|
|
foreach (var g in temp)
|
|
|
|
|
if (g != null) Destroy(g);
|
|
|
|
|
temp.Clear();
|
|
|
|
|
// keep 아닌 기절(또는 중단) = 되돌림 · keep = 그 판 전투 동안 유지(다음 연출의 wake 가 풂)
|
|
|
|
|
foreach (var body in new List<Transform>(fainted.Keys))
|
|
|
|
|
{
|
|
|
|
|
if (body == null)
|
|
|
|
|
{
|
|
|
|
|
fainted.Remove(body);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (finished && faintKeep.Contains(body)) continue;
|
|
|
|
|
Unfaint(body);
|
|
|
|
|
}
|
|
|
|
|
faintKeep.RemoveWhere(b => b == null);
|
|
|
|
|
if (trigger == "stage_start")
|
|
|
|
|
foreach (var kv in startPos)
|
|
|
|
|
{
|
|
|
|
|
if (kv.Key == null) continue;
|
|
|
|
|
kv.Key.Position = kv.Value;
|
|
|
|
|
if (kv.Key.View != null) kv.Key.View.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnDestroy()
|
|
|
|
|
{
|
|
|
|
|
if (current == this) current = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|