유니티3D/예제

powercell.cs

당꿈응 2013. 8. 26. 00:15

using UnityEngine;

using System.Collections;


public class PowerCell : MonoBehaviour {

public float Speed = 3.0f;


// Update is called once per frame

void Update () {

gameObject.transform.Rotate(Vector3.up * Speed * Time.deltaTime);

}

void OnTriggerEnter(Collider col){

if(col.gameObject.tag == "Player")

{

//col.gameObject.GetComponent<scriptName>().CellPickUP();

col.gameObject.SendMessage("CellPickUp");

Destroy(gameObject);

}

}

}