Advertisement
DugganSC

Untitled

Jun 15th, 2023
946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. public void SwapDirection()
  2. {
  3.     _spawnsRight = !_spawnsRight;
  4.     transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
  5. }
  6.  
  7. private void SpawnLightning()
  8. {
  9.     if (_lightningSpawns < 1) { return; }
  10.  
  11.     ChainLightning lightning;
  12.  
  13.     if (_spawnsRight)
  14.     {
  15.         lightning = Instantiate(this, transform.position + transform.right * _spriteRenderer.size.x * 1.3f, Quaternion.identity).GetComponent<ChainLightning>();
  16.     } else
  17.     {
  18.         lightning = Instantiate(this, transform.position - transform.right * _spriteRenderer.size.x * 1.3f, Quaternion.identity).GetComponent<ChainLightning>();
  19.         // lightning.SwapDirection();
  20.     }
  21.     lightning.setSpawns(_lightningSpawns - 1);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement