study/first_study/Assets/Scripts/PlayerSc/PlayerAttacks.cs
jh04010421 791ab6cc38 윤지호 | 유니티 연습
20226.01.23 수정 (공격 구현중)
2026-01-23 17:56:21 +09:00

70 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine.InputSystem;
[System.Serializable]
public class Weapons
{
public bool isUseable; // 공격 가능 여부
public bool isUse; // 공격중 여부
//public PlayerAttacks.classType WeaponType; // 어느 무기인가?
public int WeaponLevel;
public int atkCnt; // 공격 횟수
public float WeaponDmg; // 무기 데미지
public string animTrigger; // 애니메이션 실행 트리거 이름
}
public class PlayerAttacks : MonoBehaviour
{
private Animator animator;
bool issAtk = false; // 약공 플래그
bool isaAtk = false; // 강공 플래그
public Weapons[] weaponInfos;
Weapondata weaponBase;
public enum Types { scissor, needle, lighter};
void Start()
{
//Animator 가져오기
animator = GetComponent<Animator>();
weaponBase = GetComponent<Weapondata>();
}
void Update()
{
}
public void OnsAtk(InputValue value)
{
if (value.isPressed && !weaponInfos[0].isUse)
{
issAtk = true;
animator.SetTrigger("sAtk");
Debug.Log(" 약공격! ");
}
}
public void OnaAtk(InputValue value)
{
if (value.isPressed && !weaponInfos[0].isUse)
{
isaAtk = true;
animator.SetTrigger("aAtk");
Debug.Log(" 강공격! ");
}
}
public IEnumerator ableAtk(float sDamage, float aDamage, float frontdelaytime, float afterdelaytime)
{
weaponInfos[wea]
}
}