study/first_study/Assets/Scripts/PlayerSc/PlayerAttacks.cs

72 lines
1.9 KiB
C#
Raw Normal View History

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 Weapons
{
public bool isUseable; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
public bool isUse; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
public PlayerAttacks.Types WeaponType; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD>?
public int WeaponLevel;
public int atkCnt; // <20><><EFBFBD><EFBFBD> Ƚ<><C8BD>
public float WeaponDmg; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//public GameObject weaponObj;
//public string animTrigger; // <20>ִϸ<D6B4><CFB8>̼<EFBFBD> <20><><EFBFBD><EFBFBD> Ʈ<><C6AE><EFBFBD><EFBFBD> <20≯<EFBFBD>
}
public class PlayerAttacks : MonoBehaviour
{
private Animator animator;
public bool IsAnyWeaponInUse => weaponInfos.Any(w => w.isUse); // <20><EFBFBD><E8BFAD> true<75><65> <20><><EFBFBD><EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD><D6B4><EFBFBD> Ȯ<><C8AE>
public Weapons[] weaponInfos;
Weapondata weaponBase;
PlayerController playerController;
[SerializeField] private GameObject nano;
[SerializeField] private GameObject tera;
public enum Types {scissor, needle, lighter};
void Start()
{
//Animator <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
playerController = GetComponent<PlayerController>();
weaponBase = GetComponent<Weapondata>();
}
void Update()
{
}
public IEnumerator ableAtk(int weaponIndex, string atkType, bool isnano)
{
Debug.Log(<><C6AE><EFBFBD><EFBFBD> <20>۵<EFBFBD>");
//weaponInfos[weaponIndex].weaponObj.SetActive(true);
animator = (isnano) ? nano.GetComponent<Animator>() : tera.GetComponent<Animator>();
Debug.Log(atkType);
animator.SetTrigger(atkType);
Debug.Log($"<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: {weaponBase.frontdelaytime}<7D><>");
yield return new WaitForSeconds(weaponBase.frontdelaytime);
//weaponInfos[weaponIndex].weaponObj.SetActive(false);
Debug.Log($"<22>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: {weaponBase.afterdelaytime}<7D><>");
yield return new WaitForSeconds(weaponBase.afterdelaytime); // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
weaponInfos[weaponIndex].isUse = false;
}
}