|
|
@@ -30,6 +30,7 @@ public class Demonic : MoveCharacter
|
|
|
private int curAttackID;
|
|
|
private AttackController.AttackMethod[] am;
|
|
|
private int len;
|
|
|
+ private float pastAttackTime;
|
|
|
|
|
|
[Header("°ËŘÔ")]
|
|
|
public float adsorbSpeed; //°ËŘÔÎü¸˝ľÄËŮśČ
|
|
|
@@ -263,6 +264,7 @@ public class Demonic : MoveCharacter
|
|
|
//hurtKeepTime -= Time.deltaTime;
|
|
|
dieKeepTime -= Time.deltaTime;
|
|
|
invincibleTime -= Time.deltaTime;
|
|
|
+ pastAttackTime += Time.deltaTime;
|
|
|
Vector3 leftDir = GetMoveDir();
|
|
|
bool isAttack = GetAttack();
|
|
|
|
|
|
@@ -276,129 +278,152 @@ public class Demonic : MoveCharacter
|
|
|
}
|
|
|
if (isAttack)
|
|
|
{
|
|
|
- Attack_march();
|
|
|
- break;
|
|
|
+ if (pastAttackTime >= attackController.attackInterval)
|
|
|
+ {
|
|
|
+ Attack_march();
|
|
|
+ }
|
|
|
}
|
|
|
- if (!foot.TrigGround && !canFly)
|
|
|
+ else
|
|
|
{
|
|
|
- if (rb.velocity.y > 0)
|
|
|
+ if (!foot.TrigGround && !canFly)
|
|
|
{
|
|
|
- ChangeState(CharacterState.Rise);
|
|
|
- break;
|
|
|
+ if (rb.velocity.y > 0)
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Rise);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Fall);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ if (leftDir.x > 0.3f || leftDir.x < -0.3f)
|
|
|
{
|
|
|
- ChangeState(CharacterState.Fall);
|
|
|
+ ChangeState(CharacterState.Run);
|
|
|
break;
|
|
|
}
|
|
|
+ rb.velocity = Vector3.right * velocityAddition;
|
|
|
}
|
|
|
- if (leftDir.x > 0.3f || leftDir.x < -0.3f)
|
|
|
- {
|
|
|
- ChangeState(CharacterState.Run);
|
|
|
- break;
|
|
|
- }
|
|
|
- rb.velocity = Vector3.right * velocityAddition;
|
|
|
break;
|
|
|
case CharacterState.Run:
|
|
|
if (isAttack)
|
|
|
{
|
|
|
- Attack_march();
|
|
|
- break;
|
|
|
- }
|
|
|
- if (!foot.TrigGround && !canFly)
|
|
|
- {
|
|
|
- if (rb.velocity.y > 0)
|
|
|
+ if (pastAttackTime >= attackController.attackInterval)
|
|
|
{
|
|
|
- ChangeState(CharacterState.Rise);
|
|
|
- break;
|
|
|
+ Attack_march();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ChangeState(CharacterState.Fall);
|
|
|
- break;
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
}
|
|
|
}
|
|
|
- if (leftDir.x < 0.3f && leftDir.x > -0.3f)
|
|
|
- {
|
|
|
- ChangeState(CharacterState.Idle);
|
|
|
- break;
|
|
|
- }
|
|
|
- if (leftDir.x > 0.3f)
|
|
|
+ else
|
|
|
{
|
|
|
- //rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
|
- rb.velocity = Vector3.right * (moveSpeed + velocityAddition);
|
|
|
- //if (rb.velocity.x > maxMoveSpeed)
|
|
|
- //{
|
|
|
- // rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
- //}
|
|
|
- if (bodyTrans.localScale.x > 0)
|
|
|
+ if (!foot.TrigGround && !canFly)
|
|
|
{
|
|
|
- Turn();
|
|
|
+ if (rb.velocity.y > 0)
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Rise);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Fall);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if (leftDir.x < -0.3f)
|
|
|
- {
|
|
|
- //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
|
- rb.velocity = Vector3.right * (-moveSpeed + velocityAddition);
|
|
|
- //if (rb.velocity.x < -maxMoveSpeed)
|
|
|
- //{
|
|
|
- // rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
- //}
|
|
|
- if (bodyTrans.localScale.x < 0)
|
|
|
+ if (leftDir.x < 0.3f && leftDir.x > -0.3f)
|
|
|
{
|
|
|
- Turn();
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
+ break;
|
|
|
}
|
|
|
+ if (leftDir.x > 0.3f)
|
|
|
+ {
|
|
|
+ //rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
|
+ rb.velocity = Vector3.right * (moveSpeed + velocityAddition);
|
|
|
+ //if (rb.velocity.x > maxMoveSpeed)
|
|
|
+ //{
|
|
|
+ // rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
+ //}
|
|
|
+ if (bodyTrans.localScale.x > 0)
|
|
|
+ {
|
|
|
+ Turn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (leftDir.x < -0.3f)
|
|
|
+ {
|
|
|
+ //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
|
+ rb.velocity = Vector3.right * (-moveSpeed + velocityAddition);
|
|
|
+ //if (rb.velocity.x < -maxMoveSpeed)
|
|
|
+ //{
|
|
|
+ // rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
+ //}
|
|
|
+ if (bodyTrans.localScale.x < 0)
|
|
|
+ {
|
|
|
+ Turn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ AdjustHeight();
|
|
|
}
|
|
|
- AdjustHeight();
|
|
|
break;
|
|
|
case CharacterState.Rush:
|
|
|
if (isAttack)
|
|
|
{
|
|
|
- Attack_march();
|
|
|
- break;
|
|
|
- }
|
|
|
- if (!foot.TrigGround && !canFly)
|
|
|
- {
|
|
|
- if (rb.velocity.y > 0)
|
|
|
+ if (pastAttackTime >= attackController.attackInterval)
|
|
|
{
|
|
|
- ChangeState(CharacterState.Rise);
|
|
|
- break;
|
|
|
+ Attack_march();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ChangeState(CharacterState.Fall);
|
|
|
- break;
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
}
|
|
|
}
|
|
|
- if (leftDir.x < 0.3f && leftDir.x > -0.3f)
|
|
|
- {
|
|
|
- ChangeState(CharacterState.Idle);
|
|
|
- break;
|
|
|
- }
|
|
|
- if (leftDir.x > 0.3f)
|
|
|
+ else
|
|
|
{
|
|
|
- //rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
|
- rb.velocity = Vector3.right * runSpeed;
|
|
|
- //if (rb.velocity.x > maxMoveSpeed)
|
|
|
- //{
|
|
|
- // rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
- //}
|
|
|
- if (bodyTrans.localScale.x > 0)
|
|
|
+ if (!foot.TrigGround && !canFly)
|
|
|
{
|
|
|
- Turn();
|
|
|
+ if (rb.velocity.y > 0)
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Rise);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Fall);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if (leftDir.x < -0.3f)
|
|
|
- {
|
|
|
- //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
|
- rb.velocity = Vector3.left * runSpeed;
|
|
|
- //if (rb.velocity.x < -maxMoveSpeed)
|
|
|
- //{
|
|
|
- // rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
- //}
|
|
|
- if (bodyTrans.localScale.x < 0)
|
|
|
+ if (leftDir.x < 0.3f && leftDir.x > -0.3f)
|
|
|
{
|
|
|
- Turn();
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (leftDir.x > 0.3f)
|
|
|
+ {
|
|
|
+ //rb.velocity += Vector3.right * moveAcc * Time.deltaTime;
|
|
|
+ rb.velocity = Vector3.right * runSpeed;
|
|
|
+ //if (rb.velocity.x > maxMoveSpeed)
|
|
|
+ //{
|
|
|
+ // rb.velocity = new Vector3(maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
+ //}
|
|
|
+ if (bodyTrans.localScale.x > 0)
|
|
|
+ {
|
|
|
+ Turn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (leftDir.x < -0.3f)
|
|
|
+ {
|
|
|
+ //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
|
|
|
+ rb.velocity = Vector3.left * runSpeed;
|
|
|
+ //if (rb.velocity.x < -maxMoveSpeed)
|
|
|
+ //{
|
|
|
+ // rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
|
|
|
+ //}
|
|
|
+ if (bodyTrans.localScale.x < 0)
|
|
|
+ {
|
|
|
+ Turn();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -698,6 +723,7 @@ public class Demonic : MoveCharacter
|
|
|
curAttackID = 0;
|
|
|
}
|
|
|
attackTarget = targetCharacter;
|
|
|
+ pastAttackTime = 0;
|
|
|
}
|
|
|
|
|
|
public void DropSouls()
|