TO SQUASH: Added laser firing.

This commit is contained in:
2026-08-06 07:55:48 -04:00
parent 46198d6c44
commit 1dd8b8b786
14 changed files with 1077 additions and 8 deletions
+13 -8
View File
@@ -38,6 +38,10 @@ public class Player : MonoBehaviour
public GameObject verticalBarrierPrefab;
public GameObject horizontalLaserPrefab;
public GameObject verticalLaserPrefab;
public int lives = 8;
public int score = 0;
@@ -109,6 +113,7 @@ public class Player : MonoBehaviour
return;
}
// TODO: Generalize this to work with subset of the board bounds.
// Initialize the magnets.
magnetLeft.GetComponent<SpriteRenderer>().enabled = false;
magnetRight.GetComponent<SpriteRenderer>().enabled = false;
@@ -367,14 +372,14 @@ public class Player : MonoBehaviour
muzzleAnimator.SetTrigger("firing");
laserCount--;
// if (flipped)
// {
// Instantiate(verticalBarrierPrefab, transform.position, Quaternion.identity);
// }
// else
// {
// Instantiate(horizontalBarrierPrefab, transform.position, Quaternion.identity);
// }
if (flipped)
{
Instantiate(verticalLaserPrefab, transform.position, Quaternion.identity);
}
else
{
Instantiate(horizontalLaserPrefab, transform.position, Quaternion.identity);
}
DisableLaser();
}