|
|
@@ -44,59 +44,63 @@ public class SoulBoom : MonoBehaviour
|
|
|
Vector3 target;
|
|
|
Vector3 pos1 = characters[i].transform.position;
|
|
|
Vector3 pos2 = transform.position;
|
|
|
- if (pos1.x > pos2.x)
|
|
|
- {
|
|
|
- if (pos1.y > pos2.y)
|
|
|
- {
|
|
|
- target = new Vector3(-attackInfo.attackDir.x, attackInfo.attackDir.y,0);
|
|
|
- }
|
|
|
- else if(pos1.y < pos2.y)
|
|
|
- {
|
|
|
- target = new Vector3(-attackInfo.attackDir.x, -attackInfo.attackDir.y,0);
|
|
|
+ target = (pos1 - pos2).normalized;
|
|
|
+ //if (pos1.x > pos2.x)
|
|
|
+ //{
|
|
|
+ // if (pos1.y > pos2.y)
|
|
|
+ // {
|
|
|
+ // target = new Vector3(attackInfo.attackDir.x, attackInfo.attackDir.y,0);
|
|
|
+ // }
|
|
|
+ // else if(pos1.y < pos2.y)
|
|
|
+ // {
|
|
|
+ // target = new Vector3(attackInfo.attackDir.x, -attackInfo.attackDir.y,0);
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- target = new Vector3(-attackInfo.attackDir.x, 0,0);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(pos1.x < pos2.x)
|
|
|
- {
|
|
|
- if(pos1.y > pos2.y)
|
|
|
- {
|
|
|
- target = new Vector3(attackInfo.attackDir.x, attackInfo.attackDir.y, 0);
|
|
|
- }
|
|
|
- else if(pos1.y < pos2.y)
|
|
|
- {
|
|
|
- target = new Vector3(attackInfo.attackDir.x, -attackInfo.attackDir.y, 0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- target = new Vector3(attackInfo.attackDir.x, 0, 0);
|
|
|
- }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // target = new Vector3(attackInfo.attackDir.x, 0,0);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else if(pos1.x < pos2.x)
|
|
|
+ //{
|
|
|
+ // if(pos1.y > pos2.y)
|
|
|
+ // {
|
|
|
+ // target = new Vector3(-attackInfo.attackDir.x, attackInfo.attackDir.y, 0);
|
|
|
+ // }
|
|
|
+ // else if(pos1.y < pos2.y)
|
|
|
+ // {
|
|
|
+ // target = new Vector3(-attackInfo.attackDir.x, -attackInfo.attackDir.y, 0);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // target = new Vector3(-attackInfo.attackDir.x, 0, 0);
|
|
|
+ // }
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (pos1.y > pos2.y)
|
|
|
- {
|
|
|
- target = new Vector3(0, attackInfo.attackDir.y, 0);
|
|
|
- }
|
|
|
- else if (pos1.y < pos2.y)
|
|
|
- {
|
|
|
- target = new Vector3(0, -attackInfo.attackDir.y, 0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- target = new Vector3(0, 0, 0);
|
|
|
- }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // if (pos1.y > pos2.y)
|
|
|
+ // {
|
|
|
+ // target = new Vector3(0, attackInfo.attackDir.y, 0);
|
|
|
+ // }
|
|
|
+ // else if (pos1.y < pos2.y)
|
|
|
+ // {
|
|
|
+ // target = new Vector3(0, -attackInfo.attackDir.y, 0);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // target = new Vector3(0, 0, 0);
|
|
|
+ // }
|
|
|
|
|
|
- }
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
characters[i].BeHit
|
|
|
- (attackInfo.damage, target * attackInfo.force,
|
|
|
+ (attackInfo.damage, Vector3.zero,
|
|
|
attackInfo.changeHurt, attackInfo.repelValue);
|
|
|
+ characters[i].ChangeState(CharacterState.Hurt);
|
|
|
+ characters[i].rb.AddForce(target * attackInfo.force);
|
|
|
+
|
|
|
if (isTransfiguration)
|
|
|
{
|
|
|
characters[i].isSoulUnstable = true;
|
|
|
@@ -121,6 +125,11 @@ public class SoulBoom : MonoBehaviour
|
|
|
&& other.name == "BodyCollider")
|
|
|
{
|
|
|
MoveCharacter character = other.GetComponentInParent<MoveCharacter>();
|
|
|
+ if (character.rb == null)
|
|
|
+ {
|
|
|
+ character = character.transform.parent.GetComponent<MoveCharacter>();
|
|
|
+
|
|
|
+ }
|
|
|
if (!characters.Exists(t => t == character))
|
|
|
{
|
|
|
characters.Add(character);
|