|
|
@@ -42,14 +42,55 @@ public class SoulBoom : MonoBehaviour
|
|
|
}
|
|
|
|
|
|
Vector3 target;
|
|
|
- if (characters[i].transform.position.x > transform.position.x)
|
|
|
+ Vector3 pos1 = characters[i].transform.position;
|
|
|
+ Vector3 pos2 = transform.position;
|
|
|
+ if (pos1.x > pos2.x)
|
|
|
{
|
|
|
- target = attackInfo.attackDir;
|
|
|
+ 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, attackInfo.attackDir.y,
|
|
|
- attackInfo.attackDir.z);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|