/// <summary> /// Shoots a bullet barrage of up to 10 buullets /// </summary> /// <returns></returns> IEnumerator BulletBarrage() { shotBullets = 0; if (bullet != null) { bullet.GetComponent <Bullet_Player>().ShootBullet(); counter = 0; } for (int i = 0; i < barrageAmount; i++) { if (barrageAmount > i) { bullet = Instantiate(bulletPrefab, transform.position, Quaternion.identity); bulletLight = bullet.GetComponentInChildren <Light>(); bulletLight.range = 1; counter = 1; ShootSound(); bullet.GetComponent <Bullet_Player>().ShootBullet(); counter = 0; shotBullets++; BulletShot?.Invoke(); bullet = null; yield return(new WaitForSeconds(.1f)); } } }
private void OnBulletShot() { if (BulletShot != null) { BulletShot.Invoke(); } }
// Use this for initialization void Start() { thisTransform = transform; ShootMe = thisTransform.GetComponent <BulletShot>(); Flame = thisTransform.GetComponent <AudioSource>(); ActiveDistance = Random.Range(-3, 2); ActiveSpeed = Random.Range(5, 10); if (Managers.Game.PlayerPrefab != null) { playerTransform = Managers.Game.PlayerPrefab.transform; } StartCoroutine(CoUpdate()); }
void OnTriggerEnter(Collider collider) { BulletShot bullet = collider.GetComponent <BulletShot>(); if (bullet != null) { Debug.Log("Enemy destroyed"); bullet.explore(); GameObject obj = GameObject.Instantiate(miniCubes); obj.transform.position = transform.position - new Vector3(0, 0.25f, 0); Destroy(gameObject); } else if (collider.gameObject.name == "BaseTile") { Destroy(collider.gameObject); } else if (collider.gameObject.name == "Player") { Player.Instance.showMiniCubes(); collider.gameObject.transform.position = new Vector3(0, 20f, 0); Player.Instance.fallDawn(); } }
void Start() { _shot = GetComponent<BulletShot>(); }
private void Awake() { bulletShot = new BulletShot(this.transform.position); }
void Awake() { hp = maxHp; bulletShot = GetComponent <BulletShot>(); }
void Start() { _shot = GetComponent <BulletShot>(); }