using UnityEngine; using System.Collections; public class stickController : MonoBehaviour { public GameObject newConfetti; public bool isAttacking; public bool isSpinning; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (isAttacking) { gameObject.GetComponent ().enabled = true; gameObject.GetComponent ().enabled = true; } else { gameObject.GetComponent ().enabled = false; gameObject.GetComponent ().enabled = false; } } private void Confettishoot(Vector3 target,int size){ //creates confetti Debug.Log ("Creating Confetti"); target.y += 1.5f; for (int i = 0; i col.transform.position.y){ if (isAttacking){ col.gameObject.GetComponent().health --; col.gameObject.GetComponent().isHit = true; Confettishoot(col.gameObject.transform.position,col.gameObject.GetComponent().confettiOnHit); Vector2 velocity = col.rigidbody.velocity; velocity.y = 20; col.rigidbody.velocity = velocity; } } } } }