dronkowitz

RainbowRing.cs

Feb 8th, 2021 (edited)
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class RainbowRing : MonoBehaviour
  6. {
  7.     GameObject source;
  8.     public AudioClip clip;
  9.     // Start is called before the first frame update
  10.     void Start()
  11.     {
  12.         source = Resources.Load<GameObject>("Audio Object");
  13.         //Using the Resources folder in the Assests folder you can load up any kind of object
  14.         //With this above line of code. It loads up a GameObject named "Audio Object" From the Resources folder
  15.         //And applies it to the source variable
  16.     }
  17.  
  18.  
  19.  
  20.     private void OnTriggerEnter(Collider other)
  21.     {
  22.  
  23.  
  24.         UltimatePlayerMovement player = other.GetComponent<UltimatePlayerMovement>();
  25.         if (player)
  26.         {
  27.             GameObject ao = Instantiate(source, transform.position, Quaternion.identity);
  28.             ao.GetComponent<AudioObject>().Setup(clip, transform);
  29.  
  30.             player.Launch(transform.forward, 100);
  31.             player.SurrenderControl(Vector2.up, 2);
  32.         }
  33.  
  34.     }
  35.  
  36. }
  37.  
Add Comment
Please, Sign In to add comment