53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
public class FieldBossData : MyCoroutine
|
|
{
|
|
public bool isChapterBoss;
|
|
public int n_MonsterID, n_SpawnerId;
|
|
public float RegenTime = 10f;
|
|
|
|
MobActor m_FieldBoss;
|
|
|
|
private void Start()
|
|
{
|
|
// 필드 몬스터 생성
|
|
var fieldbossdata = table_monsterlist.Ins.Get_Data_orNull(n_MonsterID);
|
|
AddrResourceMgr.Ins.LoadObject<GameObject>(fieldbossdata.s_MonsterPrefab, handle =>
|
|
{
|
|
m_FieldBoss = DSUtil.Get_Clone<MobActor>(handle.Result, transform);
|
|
AddrResourceMgr.Ins.Set_AddressableReleaseSelf(m_FieldBoss.gameObject);
|
|
m_FieldBoss.Set(true, null, null, n_SpawnerId, false);
|
|
m_FieldBoss.Set(fieldbossdata, transform.position, AfterDie, -1);
|
|
m_FieldBoss.On_Regen();
|
|
m_FieldBoss.MagicID = 0;
|
|
ActorInfo.Ins.Add_Actor(m_FieldBoss, eRole.Mob, n_SpawnerId, fieldbossdata.s_MonsterPrefab);
|
|
});
|
|
}
|
|
|
|
private void AfterDie(int obj)
|
|
{
|
|
Set_Coroutine(() => { m_FieldBoss.On_Regen(); }, RegenTime);
|
|
if (isChapterBoss)
|
|
{
|
|
// 챕터 보스 처치 후 다음 챕터로 가는 포탈 열기
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
var mapData = MyValue.MyChoiceMapData;
|
|
sdata.MapData_SetClearChapter(mapData.n_MapID, mapData.n_Difficult);
|
|
|
|
StartCoroutine(Co_Cam());
|
|
}
|
|
}
|
|
|
|
IEnumerator Co_Cam()
|
|
{
|
|
// 이동 불가능 -> 포탈로 카메라 회전 -> 포탈 활성화 -> 이동 가능
|
|
OptionInfo.Ins.Set_PCMove(MyValue.MyPC, false);
|
|
yield return new WaitForSeconds(0.5f);
|
|
MyValue.m_RealCamera.Set_TargetShow(MapData.Ins.go_nextchapter.transform);
|
|
yield return new WaitForSeconds(1f);
|
|
MapData.Ins.go_nextchapter.SetActive(true);
|
|
yield return new WaitForSeconds(1f);
|
|
OptionInfo.Ins.Set_PCMove(MyValue.MyPC, true);
|
|
}
|
|
} |