using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using System.Runtime.Serialization.Formatters.Binary; using UnityEngine.InputSystem; /*[System.Serializable] public class WeaponStat { public WeaponData data; // ¿øº» µ¥ÀÌÅÍ public WeaponStat(WeaponData data) { this.data = data; } }*/ public class PlayerAttacks : MonoBehaviour { [Header("Nano Weapons")] [SerializeField] private List nanoWeaponList; [Header("Tera Weapons")] [SerializeField] private List teraWeaponList; [SerializeField] private WeaponHitbox Hitbox; //[SerializeField] private WeaponHitbox nanoHitbox; //[SerializeField] private WeaponHitbox teraHitbox; // ·±Å¸ÀÓ¿¡¼­ °è»êµÈ ½ºÅÈÀ» ´ã¾ÆµÑ ¸®½ºÆ® private List nanoStats = new List(); private List teraStats = new List(); private Animator animator; public bool IsAnyWeaponInUse = false; // °ø°ÝÁßÀÎÁö È®ÀÎ PlayerController playerController; [SerializeField] private GameObject nano; [SerializeField] private GameObject tera; public enum Types {scissor, needle, lighter}; void Start() { //Animator °¡Á®¿À±â playerController = GetComponent(); foreach (var data in nanoWeaponList) nanoStats.Add(new WeaponStat(data)); foreach (var data in teraWeaponList) teraStats.Add(new WeaponStat(data)); } void Update() { } public IEnumerator ableAtk(int weaponIndex, string atkType, bool isnano) { // ÇöÀç ij¸¯ÅÍ¿¡ ¸Â´Â ½ºÅȰú È÷Æ®¹Ú½º ¼³Á¤ List currentList = isnano ? nanoStats : teraStats; WeaponHitbox currentHitbox = Hitbox; /*if (weaponIndex >= currentList.Count) { Debug.LogError($"{weaponIndex}¹ø ¹«±â ¾ø"); IsAnyWeaponInUse = false; yield break; }*/ WeaponStat currentStat = currentList[weaponIndex]; Debug.Log($"°ø°Ý ´ë±â ½ÃÀÛ: {currentStat.data.frontdelaytime}ÃÊ"); yield return new WaitForSeconds(currentStat.data.frontdelaytime); animator = (isnano) ? nano.GetComponent() : tera.GetComponent(); Debug.Log(atkType); animator.SetTrigger(atkType); currentHitbox.Setup(currentStat, atkType); currentHitbox.gameObject.SetActive(true); yield return new WaitForSeconds(currentStat.data.atkDuration); currentHitbox.gameObject.SetActive(false); Debug.Log($"Èĵô·¹ÀÌ ´ë±â ½ÃÀÛ: {currentStat.data.afterdelaytime}ÃÊ"); yield return new WaitForSeconds(currentStat.data.frontdelaytime); // ÈÄ µô·¹ÀÌ IsAnyWeaponInUse = false; } }