SHARE
TWEET

Powercell

Evilgit Jun 16th, 2013 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PowerCell : MonoBehaviour
  5. {
  6.        
  7.         public float rotationSpeed = 100.0f;
  8.        
  9.         // Use this for initialization
  10.         void Start ()
  11.         {
  12.        
  13.         }
  14.        
  15.         // Update is called once per frame
  16.         void Update ()
  17.         {
  18.                 transform.Rotate(new Vector3(0, rotationSpeed * Time.deltaTime, 0)); //Sets the cell's rotation speed to rotationSpeed variable (in degrees per frame)
  19.         }
  20.        
  21.         void OnTriggerEnter(Collider col)
  22.         {
  23.                 if(col.gameObject.tag == "Player")
  24.                 {
  25.                         col.gameObject.SendMessage("CellPickup"); //Calls the CellPickup() to allow the player to get the powercell
  26.                         Destroy(gameObject); //Destroys the powercell object in the game after the player interacted with it
  27.                 }
  28.         }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top