Files
unity-vr-development/SurvivalIsland/Assets/Scripts/PowerCell.cs
T
2025-04-11 09:56:51 +08:00

31 lines
475 B
C#

using UnityEngine;
using System.Collections;
public class PowerCell : MonoBehaviour
{
public float rotationSpeed = 100.0f;
// Use this for initialization
void Start()
{
}
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player")
{
col.gameObject.SendMessage("CellPickup");
Destroy(gameObject);
}
}
// Update is called once per frame
void Update()
{
transform.Rotate(
new Vector3(0, rotationSpeed * Time.deltaTime, 0));
}
}