public void RedBubblePop() { Vector3 bubblePosInit = new Vector3(UnityEngine.Random.Range(bubbleZoneLeft, bubbleZoneRight), UnityEngine.Random.Range(bubbleZoneLower, bubbleZoneUpper), 0); Transform b = (Transform)Instantiate(RedBubblePrefab, bubblePosInit, Quaternion.identity); CurrentRedBubble = b.GetComponent <RedBubble>(); }
void Attack() { Collider2D[] col = Physics2D.OverlapPointAll(Camera.main.ScreenToWorldPoint(Input.mousePosition)); if (col.Length > 0) { foreach (Collider2D c in col) { if (c.tag == "RedBubble") { ExecuteAttack(player.damage * player.RedBubbleDamageParam, c.transform.position); RedBubble b = c.GetComponent <RedBubble>(); bm.KillRedBubble(b); return; } else if (c.tag == "Bubble") { NormalAttack(player.damage, c.transform.position); Bubble b = c.GetComponent <Bubble>(); bm.KillBubble(b); return; } } } }
public void KillRedBubble(RedBubble bubble) { Destroy(bubble.gameObject); CurrentRedBubble = null; }