31 lines
638 B
C#
31 lines
638 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class Meteor : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
public Rigidbody rigidbodyComponent;
|
||
|
public Vector3 RotationVector;
|
||
|
|
||
|
private void FixedUpdate()
|
||
|
{
|
||
|
rigidbodyComponent.velocity = new Vector3(0.5f, -0.7f, 0);
|
||
|
this.transform.Rotate(RotationVector * Time.deltaTime);
|
||
|
if (this.transform.position.y < -20)
|
||
|
{
|
||
|
Destroy(this.gameObject);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void OnTriggerEnter(Collider other)
|
||
|
{
|
||
|
if (other.gameObject.layer != 6)
|
||
|
{
|
||
|
Destroy(other.gameObject);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|