Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PowerCell : MonoBehaviour
- {
- public float rotationSpeed = 100.0f;
- // Use this for initialization
- void Start ()
- {
- }
- // Update is called once per frame
- void Update ()
- {
- transform.Rotate(new Vector3(0, rotationSpeed * Time.deltaTime, 0)); //Sets the cell's rotation speed to rotationSpeed variable (in degrees per frame)
- }
- void OnTriggerEnter(Collider col)
- {
- if(col.gameObject.tag == "Player")
- {
- col.gameObject.SendMessage("CellPickup"); //Calls the CellPickup() to allow the player to get the powercell
- Destroy(gameObject); //Destroys the powercell object in the game after the player interacted with it
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement