|
@@ -273,7 +273,7 @@ public class Demonic : MoveCharacter
|
|
|
pastAttackTime += Time.deltaTime;
|
|
pastAttackTime += Time.deltaTime;
|
|
|
Vector3 leftDir = GetMoveDir();
|
|
Vector3 leftDir = GetMoveDir();
|
|
|
bool isAttack = GetAttack();
|
|
bool isAttack = GetAttack();
|
|
|
-
|
|
|
|
|
|
|
+ Vector3 velocity = rb.velocity;
|
|
|
switch (state)
|
|
switch (state)
|
|
|
{
|
|
{
|
|
|
case CharacterState.Idle:
|
|
case CharacterState.Idle:
|
|
@@ -309,7 +309,9 @@ public class Demonic : MoveCharacter
|
|
|
ChangeState(CharacterState.Run);
|
|
ChangeState(CharacterState.Run);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- rb.velocity = Vector3.right * velocityAddition;
|
|
|
|
|
|
|
+ velocity.x = velocityAddition;
|
|
|
|
|
+ rb.velocity = velocity;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case CharacterState.Run:
|
|
case CharacterState.Run:
|
|
@@ -346,12 +348,8 @@ public class Demonic : MoveCharacter
|
|
|
}
|
|
}
|
|
|
if (leftDir.x > 0.3f)
|
|
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);
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ velocity.x = moveSpeed + velocityAddition;
|
|
|
|
|
+ rb.velocity = velocity;
|
|
|
if (bodyTrans.localScale.x > 0)
|
|
if (bodyTrans.localScale.x > 0)
|
|
|
{
|
|
{
|
|
|
Turn();
|
|
Turn();
|
|
@@ -359,12 +357,8 @@ public class Demonic : MoveCharacter
|
|
|
}
|
|
}
|
|
|
else if (leftDir.x < -0.3f)
|
|
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);
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ velocity.x = -moveSpeed + velocityAddition;
|
|
|
|
|
+ rb.velocity = velocity;
|
|
|
if (bodyTrans.localScale.x < 0)
|
|
if (bodyTrans.localScale.x < 0)
|
|
|
{
|
|
{
|
|
|
Turn();
|
|
Turn();
|
|
@@ -459,7 +453,6 @@ public class Demonic : MoveCharacter
|
|
|
ChangeState(CharacterState.Idle);
|
|
ChangeState(CharacterState.Idle);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- Vector3 velocity = rb.velocity;
|
|
|
|
|
velocity.y += extraFallGravity * Time.deltaTime;
|
|
velocity.y += extraFallGravity * Time.deltaTime;
|
|
|
if (leftDir.x > 0.3f)
|
|
if (leftDir.x > 0.3f)
|
|
|
{
|
|
{
|