public void fireBubble() { currentBubble = ammoList.ammoList.Peek(); BubbleStateHolder = currentBubble.GetComponent <RyanBubble>(); if (BubbleStateHolder.bubbleState == RyanBubble.BubbleState.Waiting) { //Play shooting sound FindObjectOfType <AudioManager>().Play("Shoot"); BubbleStateHolder.bubbleState = RyanBubble.BubbleState.Movement; currentBubble.GetComponent <Rigidbody2D>().AddForce(mousPos * startBallSpeed); StartCoroutine(ammoList.useAmmo()); } }
// Start is called before the first frame update public void setAmmo() { ammoList = new Queue <GameObject>(); selectNumber = Random.Range(0, ammoTypes.Count); newBubble = Instantiate(ammoTypes[selectNumber], new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z), Quaternion.identity); currentBullet = newBubble.GetComponent <RyanBubble>(); currentBullet.bubbleState = RyanBubble.BubbleState.Waiting; ammoList.Enqueue(newBubble); }