Example #1
0
 public void Shoot()
 {
     if (marbleReady == true && cannonLock == false)
     {
         marbleReady = false;
         shootTime   = Time.time;
         GameObject bulletMarble = transform.GetChild(0).gameObject;
         bulletMarble.transform.parent = shotMarble;
         bulletMarble.GetComponent <Rigidbody>().isKinematic = false;
         bulletMarble.GetComponent <Rigidbody>().AddForce(bulletMarble.transform.forward * marbleSpeed, ForceMode.VelocityChange);
         soundManager.PlayShootAudio();
         if (!villain)
         {
             bulletMarble.AddComponent <BulletBall>();
             Destroy(ballHint.GetChild(0).gameObject);
         }
     }
 }