카메라 타겟 고정, 씬 이동 시 투사체 모두 끄기

This commit is contained in:
Ino 2025-03-05 08:42:24 +09:00
parent 518363365c
commit bc2367a27b
9 changed files with 63 additions and 42 deletions

View File

@ -30,8 +30,6 @@ classconfig 에 의해 정해짐
- 기본 공속
- 기본 이속
- PC 장비 (현재 2종만 적용)
상태 이상 ui 표시
- https://www.notion.so/devlucas/c4dc5df0d9d64c95963c6e540acdca7c#e3ef07bc84ff424790bb723835bbce87
장비 스탯 추가 구현
- 일꾼 이속, RND_SKILL
@ -64,6 +62,9 @@ messageinfo 엄청 느린 버그
- 몬스터 패트롤 거리 조절
- 점수와 골드 (기본 1점, 10골드만 주는 중(밸런스 필요))
타겟 락 시 카메라 타겟에게 고정
로딩 UI
상태 이상 ui 표시
- https://www.notion.so/devlucas/c4dc5df0d9d64c95963c6e540acdca7c#e3ef07bc84ff424790bb723835bbce87
hud 이상 수정
타겟 락 시 카메라 타겟에게 고정

View File

@ -2063,7 +2063,7 @@ public class Actor : MyCoroutine
}
protected void Shoot_Projectile(string proj, float lifetime, Vector3 startpos)
{
if (ProjectileInfo.ProjectileInfoOn)
if (ProjectileInfo.isIns)
{
var ccData = Get_CCData(eCC.MultiShot);
var amount = 1 + (ccData.CCTime > 0f ? ccData.CCVal : 0);

View File

@ -116,7 +116,7 @@ public class BossMobActor : MobActor
protected virtual void Set_Skill1Projectile(ProjectileBase pb) { }
protected virtual void BossProjectile2(string s)
{
if (ProjectileInfo.ProjectileInfoOn)
if (ProjectileInfo.isIns)
ProjectileInfo.Ins.Shoot_Projectile(m_MonsterTableData.s_Porjectile2, this, m_Target, Get_Skill1Dmg(), Get_Skill1Pos(),
m_MonsterTableData.f_ProjectileLifeTime2, pb => { Set_Skill1Projectile(pb); });
}
@ -126,7 +126,7 @@ public class BossMobActor : MobActor
protected virtual void Set_Skill2Projectile(ProjectileBase pb) { }
protected virtual void BossProjectile3(string s)
{
if (ProjectileInfo.ProjectileInfoOn)
if (ProjectileInfo.isIns)
ProjectileInfo.Ins.Shoot_Projectile(m_MonsterTableData.s_Porjectile3, this, m_Target, Get_Skill2Dmg(), Get_Skill2Pos(),
m_MonsterTableData.f_ProjectileLifeTime3, pb => { Set_Skill2Projectile(pb); });
}

View File

@ -600,7 +600,7 @@ public class MobActor : Actor
public override void Projectile(string s)
{
base.Projectile(s);
if (ProjectileInfo.ProjectileInfoOn)
if (ProjectileInfo.isIns)
{
if (m_MonsterTableData.n_PassiveSkillID > 0)
{

View File

@ -457,6 +457,7 @@ public class PCActor : MyActor
ActorInfo.Ins.All_Stop(true);
NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.DieOrQuit);
DungeonInfo.Ins.Sub_WaveLife();
MonsterSimpleInfo.Ins.Set_DelLockTarget(true);
}
protected override IEnumerator Co_ScaleControl(bool returntoOriginalScale, float targetscale, Action actComplete = null)

View File

@ -163,6 +163,7 @@ public partial class InGameInfo : MyCoroutine
public void Load_Map(int id)
{
AllEffectOff();
if (ProjectileInfo.isIns) ProjectileInfo.Ins.AllOff();
MyValue.MyChoiceMapData.n_MapID = id;
var Tdata = table_battlemapconfig.Ins.Get_Data(MyValue.MyChoiceMapData.n_MapID);
m_GameMode = Tdata.e_MapType;

View File

@ -5,7 +5,7 @@ using UnityEngine;
public class ProjectileInfo : MonoBehaviour
{
public static bool ProjectileInfoOn = false;
public static bool isIns = false;
public static ProjectileInfo Ins;
public Material[] arr_materials; // 0 얼음, 1 히트
@ -18,7 +18,14 @@ public class ProjectileInfo : MonoBehaviour
private void Awake()
{
Ins = this;
ProjectileInfoOn = true;
isIns = true;
}
public void AllOff()
{
foreach (var projectileList in dic_projectile.Values)
foreach (var projectile in projectileList)
projectile.gameObject.SetActive(false);
}
IEnumerator Start()

View File

@ -10,17 +10,19 @@ public class MonsterSimpleInfo : MonoBehaviourSingletonTemplate<MonsterSimpleInf
public TextMeshProUGUI[] labels; // 0 레벨
public Slider slider_hp;
bool isActor;
Actor m_Actor;
private void Start() { Off(); }
public void Off() { go_child.SetActive(false); m_Actor = null; }
public void Off() { go_child.SetActive(false); m_Actor = null; isActor = false; }
public void Set(Actor actor)
{
if (!DSUtil.CheckNull(m_Actor) && m_Actor.m_IsLockTarget) return;
if (isActor && m_Actor.m_IsLockTarget) return;
go_child.SetActive(true);
m_Actor = actor;
isActor = true;
go_boss.SetActive(m_Actor.IsSubRole(eSubRol.Boss));
//sprites[0].spriteName = ""; // TODO 정인호 : 몹 얼굴 없음
@ -32,13 +34,21 @@ public class MonsterSimpleInfo : MonoBehaviourSingletonTemplate<MonsterSimpleInf
private void Update()
{
if (!DSUtil.CheckNull(m_Actor))
slider_hp.value = (float)(m_Actor.Get_HP() / m_Actor.Get_MaxHP());
if (isActor) slider_hp.value = (float)(m_Actor.Get_HP() / m_Actor.Get_MaxHP());
}
public void Set_DelLockTarget(bool isDead)
{
sprites[1].canvasRenderer.SetAlpha(0.25f);
m_Actor.m_IsLockTarget = false;
MyValue.MyPC.Del_Target();
MyValue.m_RealCamera.Set_LockTarget(null);
if (isDead) Off();
}
public void OnClick_Lock()
{
if (!DSUtil.CheckNull(m_Actor))
if (isActor)
{
m_Actor.m_IsLockTarget = !m_Actor.m_IsLockTarget;
@ -46,22 +56,16 @@ public class MonsterSimpleInfo : MonoBehaviourSingletonTemplate<MonsterSimpleInf
{
sprites[1].canvasRenderer.SetAlpha(1f);
MyValue.MyPC.Change_Target(true, m_Actor);
MyValue.m_RealCamera.Set_LockTarget(m_Actor.transform);
}
else
{
sprites[1].canvasRenderer.SetAlpha(0.25f);
MyValue.MyPC.Del_Target();
}
Set_DelLockTarget(false);
}
}
public void OnClick_Close()
{
if (!DSUtil.CheckNull(m_Actor))
{
m_Actor.m_IsLockTarget = false;
MyValue.MyPC.Del_Target();
}
if (isActor) Set_DelLockTarget(false);
Off();
}
}

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
public class RealCamera : MyCoroutine
{
@ -42,6 +43,9 @@ public class RealCamera : MyCoroutine
GameObject godummy, gowitch;
List<Transform> list_tfCamactionTarget = new List<Transform>();
bool islockTarget;
Transform tf_lockTarget;
private void Awake()
{
OriminDistance = minDistance;
@ -91,17 +95,26 @@ public class RealCamera : MyCoroutine
}
}
public void Add_CamActionTarget(Transform _target) { list_tfCamactionTarget.Add(_target); }
public void Set_LockTarget(Transform locktarget)
{
tf_lockTarget = locktarget;
islockTarget = tf_lockTarget;
}
public void Set_TargetShow(Transform _target)
{
if (CamStatus != 0 && isTarget)
{
// 매개변수 타겟을 보게 카메라 회전
if (godummy == null) godummy = new GameObject("CamDummy");
godummy.transform.position = target.position;
godummy.transform.LookAt(_target);
Set_CamDummy(_target);
Set_Coroutine(() => { rotateAround = godummy.transform.eulerAngles.y - 45f; }, 0.1f);
}
}
void Set_CamDummy(Transform _target)
{
if (godummy == null) godummy = new GameObject("CamDummy");
godummy.transform.position = target.position;
godummy.transform.LookAt(_target);
}
public void Set_Axis(bool _horizontal, float _value)
{
DragEndTime = 1f;
@ -184,43 +197,37 @@ public class RealCamera : MyCoroutine
void Update_Cam()
{
//Offset of the targets transform (Since the pivot point is usually at the feet).
Vector3 targetOffset = target.position;
Quaternion rotation = Quaternion.Euler(cameraHeight, rotateAround, cameraPan);
Vector3 vectorMask = Vector3.one;
Vector3 rotateVector = rotation * vectorMask;
//this determines where both the camera and it's mask will be.
//the camMask is for forcing the camera to push away from walls.
camPosition = targetOffset + Vector3.up * DistanceUp - rotateVector * DistanceAway;
camMask = targetOffset + Vector3.up * DistanceUp - rotateVector * DistanceAway;
//occludeRay(ref targetOffset);
transform.position = Vector3.Lerp(transform.position, camPosition, Time.deltaTime * smooth);
if (m_BackMove)
{
Vector3 backOffsetDirection = -transform.forward.normalized * m_BackOffSet.z;
transform.position += new Vector3(backOffsetDirection.x, 0f, backOffsetDirection.z);
}
if (islockTarget)
{
Set_CamDummy(tf_lockTarget);
rotateAround = godummy.transform.eulerAngles.y - 45f;
}
transform.LookAt(target.position + m_LookAt);
#region wrap the cam orbit rotation
if (rotateAround > 360)
{
rotateAround = 0f;
}
else if (rotateAround < 0f)
{
rotateAround = (rotateAround + 360f);
}
if (rotateAround > 360) rotateAround = 0f;
else if (rotateAround < 0f) rotateAround += 360f;
#endregion
rotateAround += HorizontalAxis * camRotateSpeed * Time.deltaTime;
//rotateAround = 145;
if (HorizontalAxis >= -0.1f || HorizontalAxis <= 0.1f) HorizontalAxis = 0f;
//DistanceUp = Mathf.Clamp(DistanceUp += VerticalAxis, -0.79f, 2.3f);
DistanceAway = Mathf.Clamp(DistanceAway += VerticalAxis, minDistance, maxDistance);