|
|
@@ -38,6 +38,8 @@ public class Bullet : MonoBehaviour
|
|
|
[ShowIf("@bulletType == BulletType.Boomerang")]
|
|
|
public AttackTrigger attackTrigger;
|
|
|
[ShowIf("@bulletType == BulletType.Boomerang")]
|
|
|
+ public CameraController cameraController;
|
|
|
+ [ShowIf("@bulletType == BulletType.Boomerang")]
|
|
|
public Animator attackAni;
|
|
|
private Vector3 originalPos;
|
|
|
|
|
|
@@ -128,8 +130,11 @@ public class Bullet : MonoBehaviour
|
|
|
{
|
|
|
velocity.x = 0;
|
|
|
}
|
|
|
+ if (transform.position.x <= cameraController.leftBoundary || transform.position.x >= cameraController.rightBoundary)
|
|
|
+ {
|
|
|
+ velocity.x = 0;
|
|
|
+ }
|
|
|
rb.velocity = velocity;
|
|
|
- attackAni.enabled = false;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
@@ -163,14 +168,20 @@ public class Bullet : MonoBehaviour
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ Vector3 velocity ;
|
|
|
if(transform.position.y > 0.5f)
|
|
|
{
|
|
|
- rb.velocity = dir * speed * (1 - flyTime / backDuration);
|
|
|
+ velocity = dir * speed * (1 - flyTime / backDuration);
|
|
|
+ if(transform.position.x <= cameraController.leftBoundary || transform.position.x >= cameraController.rightBoundary)
|
|
|
+ {
|
|
|
+ velocity = Vector3.zero;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- rb.velocity = Vector3.zero;
|
|
|
+ velocity = Vector3.zero;
|
|
|
}
|
|
|
+ rb.velocity = velocity;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -229,7 +240,6 @@ public class Bullet : MonoBehaviour
|
|
|
if (attackAni)
|
|
|
{
|
|
|
attackAni.gameObject.SetActive(true);
|
|
|
- attackAni.enabled = true;
|
|
|
}
|
|
|
isInVain = false;
|
|
|
}
|