Пример #1
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log("What this?");
     if (other.gameObject.CompareTag("Gummy"))
     {
         GummyFollow gummy = other.GetComponent <GummyFollow>();
         if (gummy.followPlayer == false && !gummies.Contains(gummy))
         {
             Debug.Log("GUMMY HIT");
             gummy.stop = true;
             gummies.Add(gummy);
         }
     }
 }
 void Update()
 {
     //If enough gummies are in the area
     if (gummies.Count >= gummiesNeeded)
     {
         //Go through the gummies needed, remove them from the list, and destroy them
         for (int i = 0; i < gummiesNeeded; i++)
         {
             GummyFollow currentGummy = gummies[0];
             gummies.RemoveAt(0);
             Destroy(currentGummy.gameObject);
         }
         //Make the item
         Instantiate(gummyItem, spawnPoint.position, gummyItem.transform.rotation);
         //Destroy the collider area
         Destroy(this.gameObject);
     }
 }
Пример #3
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log("What this?");
     //If a gummy hits the slingshot
     if (other.gameObject.CompareTag("Gummy"))
     {
         GummyFollow gummy = other.GetComponent <GummyFollow>();
         //If the gummy isn't following the player
         if (gummy.followPlayer == false)
         {
             Debug.Log("GUMMY HIT");
             gummy.stop = true;
             //Shoot the gummy using physics
             Rigidbody gummyRb = gummy.GetComponent <Rigidbody>();
             gummyRb.isKinematic = false;
             gummyRb.AddForce(new Vector3(0, power, power));
             //gummies.Add(gummy);
         }
     }
 }
Пример #4
0
 void Start()
 {
     followScipt = GetComponent <GummyFollow>();
 }