using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; public class WizardActor : PCActor { float t = 1f; void Shoot_MyProjectile() { Reset_AttackCoolTime(); m_DamageRate = 1f; if (InGameInfo.Ins.Get_SelectSkillData(eEffect.Select_DoubleShot)) { m_DamageRate = table_selectskill.Ins.Get_Data(eEffect.Select_DoubleShot).ValueBase; Set_Coroutine(Shoot_MagicMissile, 0.25f); } if (InGameInfo.Ins.Get_SelectSkillData(eEffect.Select_TripleShot)) { m_DamageRate = table_selectskill.Ins.Get_Data(eEffect.Select_TripleShot).ValueBase; Set_Coroutine(Shoot_MagicMissile, 0.5f); } Shoot_MagicMissile(); } void Shoot_MagicMissile() { ProjectileInfo.Ins.Shoot_Projectile("MagicMissile", this, m_Target, m_DamageRate, Get_ProjectileStartPos(), 10f); #if UNITY_EDITOR if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "StatTest") return; #endif NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.JoystickAttack); } private void OnTriggerEnter(Collider other) { if (other.tag.Equals("House")) MyValue.m_RealCamera.Set_InsideBuilding(true); else if (other.tag.Equals("DropItem")) other.GetComponent().ItemTouch(); } private void OnTriggerExit(Collider other) { if (other.tag.Equals("House")) MyValue.m_RealCamera.Set_InsideBuilding(false); } public override void Move(float b) { base.Move(b); #if UNITY_EDITOR if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "StatTest") return; #endif Set_Move(transform.position + transform.forward * b); } public override void Interpolation(string s) { base.Interpolation(s); #if UNITY_EDITOR if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "StatTest") return; #endif StartCoroutine(Co_Interpolation(s)); } IEnumerator Co_Interpolation(string s) { var dic_frame = new Dictionary(); var clips = m_animation.GetCurrentAnimatorClipInfo(0); if (clips.Length == 0) yield break; var currentClip = clips[0].clip; var totalFrame = Mathf.RoundToInt(currentClip.frameRate * currentClip.length); var split = s.Split(','); for (int i = 0; i < split.Length - 1; i++) dic_frame.Add(int.Parse(split[i]), false); var valueperframe = float.Parse(split[split.Length - 1]); Set_Warp(transform.position + transform.forward * valueperframe); // 제일 처음 프레임은 실행하고 시작 float t = 0f; int prevFrame = 0; while (!dic_frame[dic_frame.Keys.Max()]) { var curState = m_animation.GetCurrentAnimatorStateInfo(0); var curFrame = (int)(curState.normalizedTime * totalFrame); // 놓친 프레임을 보완하기 위한 체크 for (int frame = prevFrame + 1; frame <= curFrame; frame++) { if (dic_frame.ContainsKey(frame) && !dic_frame[frame] && m_NavMeshAgent.isOnNavMesh && !IsOnlyDead()) { dic_frame[frame] = true; //Set_Move(transform.position + transform.forward * valueperframe); //Set_Warp(transform.position + transform.forward * valueperframe); m_NavMeshAgent.Move(transform.forward * valueperframe); } } prevFrame = curFrame; yield return null; t += Time.deltaTime; if (t >= curState.length) break; } } public override void Dodge(int a) { base.Dodge(a); m_bCanDodge = a > 0; //Debug.Log($"m_bCanDodge : {m_bCanDodge}"); } public override void Immortal(int a) { base.Immortal(a); m_bImmortal = a > 0; //Debug.Log($"m_bImmortal : {m_bImmortal}"); } }