펫 및 일꾼 로딩 타이밍 수정 등

This commit is contained in:
Ino 2025-03-07 15:50:46 +09:00
parent 8c3b53eb45
commit 006643905a
12 changed files with 63 additions and 26 deletions

View File

@ -61,5 +61,7 @@ messageinfo 엄청 느린 버그
장비 스탯 추가 구현
- 일꾼 이속, RND_SKILL
일꾼 추가
일꾼
- 일꾼이 아이템 줍기
- 나의 일꾼 만들기
- 서버 데이터

View File

@ -20,4 +20,3 @@ TerrainLayer:
m_DiffuseRemapMax: {x: 1, y: 1, z: 1, w: 1}
m_MaskMapRemapMin: {x: 0, y: 0, z: 0, w: 0}
m_MaskMapRemapMax: {x: 1, y: 1, z: 1, w: 1}
m_SmoothnessSource: 1

View File

@ -20,4 +20,3 @@ TerrainLayer:
m_DiffuseRemapMax: {x: 1, y: 1, z: 1, w: 1}
m_MaskMapRemapMin: {x: 0, y: 0, z: 0, w: 0}
m_MaskMapRemapMax: {x: 1, y: 1, z: 1, w: 1}
m_SmoothnessSource: 1

View File

@ -626,6 +626,12 @@ public class Actor : MyCoroutine
// 펫 부활
var pet = ActorInfo.Ins.Get_Actor(eRole.Pet);
if (!DSUtil.CheckNull(pet)) pet.On_Regen();
// 일꾼 이동
if (!IsEnemy())
{
var worker = ActorInfo.Ins.Get_Actor(eRole.Worker);
if (!DSUtil.CheckNull(worker)) worker.On_Regen();
}
// PC 부활
On_Regen();
break;

View File

@ -201,12 +201,13 @@ public class PCActor : MyActor
protected override bool IsAvoidCoolTime() { return m_AvoidCoolTime > 0f; }
protected override void Set_AvoidCoolTime() { m_AvoidCoolTime = table_GlobalValue.Ins.Get_Int("f_AvoidCoolTime"); }
public void StartCam()
public void StartCam(Action<Vector3> actGetPos)
{
Camera.main.fieldOfView = 60f;
LoadMapMgr.Ins.Get_PortalPos(MyValue.MyChoiceMapData, portalpos =>
{
MyValue.m_RealCamera.Set_Target(transform, Get_RealCamRotAround(portalpos));
actGetPos?.Invoke(portalpos);
});
}
float Get_RealCamRotAround(Vector3 portalpos)

View File

@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WorkerActor : Actor
@ -8,19 +6,17 @@ public class WorkerActor : Actor
DropItem go_finditem;
float SeekTime = 5f, t;
Actor m_Owner;
bool isOwner;
byte Status = 0; // 0 아이들, 1 캐릭터 뒤로 이동 중, 2 아이템으로 이동 중
protected override void Awake()
{
base.Awake();
m_Stat = new ActorStatInfo(eRole.Fairy, ServerInfo.Ins.m_ServerData, null);
}
public override void Set(bool isEnemy, Actor owner, ServerData sdata, int _id, bool _stop, bool _ui = false)
{
base.Set(isEnemy, owner, sdata, _id, _stop);
m_Role = eRole.Worker;
m_Owner = owner;
isOwner = m_Owner;
//m_Stat = new ActorStatInfo(m_Role, sdata, null);
m_WorkerListTableData = table_worker.Ins.Get_Data_orNull(_id);
if (!_ui)
@ -33,6 +29,11 @@ public class WorkerActor : Actor
}
}
public override void On_Regen(bool reincarnation = false, float healrate = 1)
{
Set_Warp(Get_Pos());
}
Vector3 Get_Pos()
{
return DSUtil.Get_RandomPos_onNavMesh(m_Owner.Get_position(), 0f, 1f);
@ -65,7 +66,7 @@ public class WorkerActor : Actor
}
}
if (Status == 0 && Vector3.Distance(m_Owner.Get_position(), Get_position()) > 3f)
if (Status == 0 && isOwner && Vector3.Distance(m_Owner.Get_position(), Get_position()) > 3f)
{ // 캐릭터 근처로 옴
Play_Run();
Set_Path(Get_Pos());

View File

@ -19,8 +19,13 @@ public class ActorInfo : MonoBehaviour
List<eRole> destroylst = new List<eRole> { eRole.PC, eRole.Pet, eRole.Fairy, eRole.Mob, eRole.BattleNPC, eRole.OBJ, eRole.Farmer };
Actor m_MyWorker;
public void Destroy_Mobs()
{
if (!DSUtil.CheckNull(m_MyWorker))
Destroy(m_MyWorker.gameObject);
foreach (var role in destroylst)
{
// dic_actor 딕셔너리에서 destroylst에 포함된 역할(eRole)에 해당하는 항목만 처리
@ -101,8 +106,13 @@ public class ActorInfo : MonoBehaviour
}
public void Add_Actor(Actor actor, eRole role, int spawnerId, string prefabName)
{ // 생성한 액터 추가
Check_ActorDic(spawnerId, role, prefabName);
dic_actor[role][spawnerId][prefabName].Add(actor);
if (role == eRole.Worker)
m_MyWorker = actor;
else
{
Check_ActorDic(spawnerId, role, prefabName);
dic_actor[role][spawnerId][prefabName].Add(actor);
}
}
public void All_Heal(float rate)
@ -179,6 +189,8 @@ public class ActorInfo : MonoBehaviour
public Actor Get_Actor(eRole role, int spawnerId = 0)
{
if (role == eRole.Worker) return m_MyWorker;
if (dic_actor.ContainsKey(role))
{
foreach (var item in dic_actor[role][spawnerId])

View File

@ -183,7 +183,7 @@ public partial class InGameInfo : MyCoroutine
IEnumerator Co_StartCam()
{
while (!MyValue.bMyPC) yield return null;
MyValue.MyPC.StartCam();
MyValue.MyPC.StartCam(null);
}
#region HUD

View File

@ -4,7 +4,7 @@ using UnityEngine.ResourceManagement.AsyncOperations;
public class PCInfo : MonoBehaviourSingletonTemplate<PCInfo>
{
public void Make_Actors(bool _IsEnemy, ServerData sdata, bool startcam = false)
public void Make_Actors(bool _IsEnemy, ServerData sdata)
{
var curMapData = MyValue.MyChoiceMapData;
@ -21,13 +21,14 @@ public class PCInfo : MonoBehaviourSingletonTemplate<PCInfo>
AddrResourceMgr.Ins.Set_AddressableReleaseSelf(pc.gameObject);
pc.Set(_IsEnemy, null, sdata, pcid, true);
pc.Set_MyPet(null);
if (startcam) (pc as PCActor).StartCam();
(pc as PCActor).StartCam(pos =>
{
// Pets -> 2024. 9. 21 펫은 한 마리로 변경
dic_petbattle_deadcount[_IsEnemy][0] = dic_petbattle_deadcount[_IsEnemy][1] = 0;
Make_Pet(_IsEnemy, sdata, pc); // 펫 생성
Make_Worker(sdata, pc); // 일꾼 생성
});
ActorInfo.Ins.Add_Actor(pc, _IsEnemy ? eRole.EnemyPC : eRole.PC, 0, costumetable.s_Prefab);
var chapter = curMapData.n_MapID;
// Pets -> 2024. 9. 21 펫은 한 마리로 변경
dic_petbattle_deadcount[_IsEnemy][0] = dic_petbattle_deadcount[_IsEnemy][1] = 0;
Make_Pet(_IsEnemy, sdata, pc);
}
});
@ -81,6 +82,21 @@ public class PCInfo : MonoBehaviourSingletonTemplate<PCInfo>
NewGameUI.Ins.arr_PetCard[0].Set_Empty();
}
}
public void Make_Worker(ServerData sdata, Actor pc)
{
var workerid = sdata.Get_EqiupmentEquip(eItem.Worker);
if (workerid > 0)
{
var workerData = table_worker.Ins.Get_Data_orNull(workerid);
AddrResourceMgr.Ins.LoadObject<GameObject>($"Assets/Res_Addr/Worker/{workerData.s_Prefab}.prefab", handle =>
{
var worker = DSUtil.Get_Clone<Actor>(handle.Result, transform, null, workerData.f_Scale * Vector3.one);
ActorInfo.Ins.Add_Actor(worker, eRole.Worker, 0, "");
AddrResourceMgr.Ins.Set_AddressableReleaseSelf(worker.gameObject);
worker.Set(false, pc, sdata, workerid, false);
});
}
}
public void Make_Farmer(int _id)
{
if (_id > 0)

View File

@ -2302,6 +2302,7 @@ public class SD_Equip
[eItem.Pet] = table_GlobalValue.Ins.Get_Int("n_FirstEquipPet"),
[eItem.Fairy] = 0,
[eItem.Farmer] = 0,
[eItem.Worker] = 70001,
};
foreach (var item in Equip) item.Value.RandomizeCryptoKey();

View File

@ -42,7 +42,7 @@ public class PCUI : BotMenuBase
ActorInfo.Ins.Destroy_Mobs();
CoroutineMgr.Ins.Set_Coroutine(() =>
{
PCInfo.Ins.Make_Actors(false, ServerInfo.Ins.m_ServerData, true);
PCInfo.Ins.Make_Actors(false, ServerInfo.Ins.m_ServerData);
}, 0.02f);
}
}

View File

@ -2,7 +2,7 @@ public enum eGameMode { Lobby, Stage, MyFarm, Dungeon, Max } // list 순서
public enum eDungeon { None, d1_Mimic, d2_Maze, d3_Nightmare, d4_Wave }
public enum eDifficult { Normal, Hard, NightMare, Hell, Max }
public enum eUnlockCondition { None, BossKill, GetItem, SealBreaking, ChapterClear, }
public enum eRole { Mob, Pet, PC, Fairy, EnemyPC, Farmer, Summon, BattleNPC, OBJ, EnemyPet, EnemySummon }
public enum eRole { Mob, Pet, PC, Worker, Fairy, EnemyPC, Farmer, Summon, BattleNPC, OBJ, EnemyPet, EnemySummon }
public enum eSubRol { None, Elite, Boss, Mimic, Summon }
public enum eClassType { SwordMan, Archer, Fighter, Mage }
public enum eSpawnerType { Random, Order, Phase, PhaseAllKill }