private void Start() { collider = gameObject.GetComponent <Collider2D>(); rigidbody = gameObject.GetComponent <Rigidbody2D>(); if (collider == null) { throw new System.Exception("The player does not have a 2D collider attached."); } if (rigidbody == null) { throw new System.Exception("The player does not have a 2D rigidbody attached."); } ship = transform.Find("Ship").gameObject; Health3 = GameObject.Find("Health3").gameObject; Health2 = GameObject.Find("Health2").gameObject; Health1 = GameObject.Find("Health1").gameObject; spawner = gameObject.GetComponent <Spawner>(); bullet = new PatternSpawn(0f, new LineSpawn(SpawnPattern.Single(10f), 3, Vector2.left * 0.2f + Vector2.down * 0.1f, 0f), new LineSpawn(SpawnPattern.Single(10f), 3, Vector2.right * 0.2f + Vector2.down * 0.1f, 0f)); fireSound = Resources.Load <GameObject>("Prefabs/Laser"); damageSound = Resources.Load <GameObject>("Prefabs/PlayerDamage"); deathSound = Resources.Load <GameObject>("Prefabs/Death"); }
public static BulletSpawnDefinition InterlievedFan(float speed, int volleyCount, float spawnPeriod, int bulletsPerVolley) { return(new FanSpawn( SpawnPattern.InterleavedFan( 15, bulletsPerVolley, spawnPeriod / 2f, SpawnPattern.Single(speed)), volleyCount, 1f, spawnPeriod, center: false)); }
// Start is called before the first frame update void Start() { var pattern = new RepeatSpawn(SpawnPattern.InterleavedFan(15, 7, 0.5f, SpawnPattern.Single(2f)), 5, 1f); DropInOut.Create(dropInOutPrefab, transform.position, transform.position + Vector3.down * 10f, transform.position, 10, pattern, transform.position + Vector3.down * 15f); }