20226.01.29 수정 (캐릭터, 무기, 공격타입 세분화 완료, 히트박스 게임오버 트리거 작동 버그 발견)
다음 작업 : 캐릭터 스탯 구현, 공격 데미지 구현, 사망 구현
**히트박스 트리거 버그**
{히트박스가 게임오버를 건드리면 캐릭터가 멈춤}
73 lines
1.7 KiB
C#
73 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor.U2D.Animation;
|
|
using UnityEngine;
|
|
using UnityEngine.PlayerLoop;
|
|
|
|
|
|
[System.Serializable]
|
|
public class PlayerStat
|
|
{
|
|
|
|
[SerializeField] private float baseValue;
|
|
|
|
private float _value;
|
|
private bool _isChange = true;
|
|
|
|
private List<float> modifiers = new List<float>();
|
|
|
|
public PlayerStat(float baseValue)
|
|
{
|
|
this.baseValue = baseValue;
|
|
}
|
|
private float CalculStat()
|
|
{
|
|
float finalValue = baseValue;
|
|
foreach(float m in modifiers)
|
|
{
|
|
_value += m;
|
|
}
|
|
return finalValue;
|
|
}
|
|
public float fvalue
|
|
{
|
|
get { return fvalue; }
|
|
}
|
|
public int ivalue
|
|
{
|
|
get { return ivalue; }
|
|
}
|
|
}
|
|
public class PlayerBase : MonoBehaviour
|
|
{
|
|
[Header("Character Data")]
|
|
[SerializeField] private CharacterStat characterStat;
|
|
public PlayerStat playerMaxSpeed;
|
|
public PlayerStat playerJumpPower;
|
|
public PlayerStat playerMaxJumpCount;
|
|
public PlayerStat playerHp;
|
|
public PlayerStat playerStamina;
|
|
void Awake()
|
|
{
|
|
if (characterStat == null)
|
|
{
|
|
Debug.LogError("Character Data°¡ ÇÒ´çµÇÁö ¾Ê¾Ò½À´Ï´Ù!");
|
|
}
|
|
else
|
|
{
|
|
InitializeStat();
|
|
}
|
|
}
|
|
public void InitializeStat()
|
|
{
|
|
playerMaxSpeed = new PlayerStat(characterStat.playerMaxSpeed);
|
|
playerJumpPower = new PlayerStat(characterStat.playerJumpPower);
|
|
playerMaxJumpCount = new PlayerStat(characterStat.playerMaxJumpCount);
|
|
playerHp = new PlayerStat(characterStat.playerHp);
|
|
playerStamina = new PlayerStat(characterStat.playerStamina);
|
|
}
|
|
|
|
|
|
}
|