Skip to content

Commit

Permalink
Added variables for customizing base explosion
Browse files Browse the repository at this point in the history
  • Loading branch information
ddabble committed Oct 16, 2021
1 parent 6d2adca commit 7f4ce6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Assets/Prefabs/Base/Base.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,14 @@ MonoBehaviour:
m_EditorClassIdentifier:
gameOverScreen: {fileID: 6406541465688870762, guid: cf6616ecfd76d4b379c4e4fd196293af, type: 3}
destroyedBase: {fileID: 7907768064546073796, guid: ced5130962de4c54185e3ca432063c03, type: 3}
distortionField: {fileID: 0}
deathParticles: {fileID: 0}
spawnPoint: {fileID: 5829545455071137389}
crystals: 0
drainRay: {fileID: 2977432110045038679, guid: 1fa3e9df0696ada43b1fbfe045184210, type: 3}
explosionLightningCount: 20
explosionLightningSpawnDelay: 0.2
mainCrystal: {fileID: 0}
--- !u!114 &990519977
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
7 changes: 5 additions & 2 deletions Assets/Scripts/GameState/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class BaseController : MonoBehaviour
public GameObject drainRay;
private List<Ray> rays = new List<Ray>();

public int explosionLightningCount = 20;
public float explosionLightningSpawnDelay = 0.2f;

public Transform SpawnPoint => spawnPoint;

// Crystal Transform
Expand Down Expand Up @@ -184,7 +187,7 @@ IEnumerator Explode()
Transform[] transforms = GameObject.FindObjectsOfType<Transform>();

// Create lightning as the crystal charges
for (float t = 4f; t >= 0; t -= 0.2f)
for (int _ = 0; _ >= explosionLightningCount; _++)
{
int i = Random.Range(0, transforms.Length);

Expand All @@ -199,7 +202,7 @@ IEnumerator Explode()
// Ensure correct camera focus
Camera.main.GetComponent<CameraFocusController>().Focus(transform);

yield return new WaitForSeconds(0.2f);
yield return new WaitForSeconds(explosionLightningSpawnDelay);
}

// Replace the base with a rigidbody based one
Expand Down

0 comments on commit 7f4ce6e

Please sign in to comment.