Commit 2bfab18a authored by 15김민규's avatar 15김민규

바꾼거 없는데 머지하려고 푸쉬함

parent 21922661
...@@ -799,11 +799,6 @@ Prefab: ...@@ -799,11 +799,6 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 11 value: 11
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 114138317320723260, guid: a164c147037e89448820f7387c724c42,
type: 2}
propertyPath: attackRange
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a164c147037e89448820f7387c724c42, type: 2} m_SourcePrefab: {fileID: 100100000, guid: a164c147037e89448820f7387c724c42, type: 2}
m_IsPrefabAsset: 0 m_IsPrefabAsset: 0
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeleeAttack : StateMachineBehaviour {
float timer;
float attackDelay;
float attackDuration;
enum SubState
{
BEFOREATTACK,
CASTING,
ATTACKING
}
SubState subState;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
attackDelay = animator.GetComponent<Enemy>().attackDelay;
attackDuration = animator.GetComponent<Enemy>().attackDuration;
subState = SubState.BEFOREATTACK;
timer = 0.0f;
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
timer += Time.deltaTime;
if (timer < attackDelay)
{
if (subState == SubState.BEFOREATTACK)
{
subState = SubState.CASTING;
}
// action during casting attack
}
else if (timer < attackDelay + attackDuration)
{
if (subState == SubState.CASTING)
{
subState = SubState.ATTACKING;
animator.transform.GetChild(0).GetComponents<BoxCollider2D>()[0].enabled = true;
}
}
else
{
animator.SetTrigger("TrackTrigger");
}
}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
animator.transform.GetChild(0).GetComponents<BoxCollider2D>()[0].enabled = false;
}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
}
fileFormatVersion: 2
guid: e92be6a4d81dc134fbe2097609bb180b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -57,7 +57,7 @@ public class Enemy : MonoBehaviour { ...@@ -57,7 +57,7 @@ public class Enemy : MonoBehaviour {
public void GetDamaged(float damage) { public void GetDamaged(float damage) {
currHealth -= damage; currHealth -= damage;
if(currHealth <= 0) { if(currHealth <= 0) {
Destroy(gameObject); gameObject.SetActive(false);
return; return;
} }
float knockback_dist = damage * unitDist / weight; float knockback_dist = damage * unitDist / weight;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment