Tạo mối nguy hiểm

0
95

Tạo mối nguy hiểm
Đã kiểm tra với phiên bản: 5.1
– –
Khó khăn: Người mới bắt đầu
Tạo ra một mối nguy tiểu hành tinh để thách thức người chơi.

RandomRotator

Expand view

Copy code
using UnityEngine;
using System.Collections;

public class RandomRotator : MonoBehaviour
{
public float tumble;

void Start ()
{
rigidbody.angularVelocity = Random.insideUnitSphere * tumble;
}
}


1


2


3


4


5


6


7


8


9


10


11


12


DestroyByContact

Expand view

Copy code
using UnityEngine;
using System.Collections;

public class DestroyByContact : MonoBehaviour
{
void OnTriggerEnter(Collider other)
{
if (other.tag == "Boundary")
{
return;
}
Destroy(other.gameObject);
Destroy(gameObject);
}
}


1


2


3


4


5


6


7


8


9


10


11


12


13


14


15


LEAVE A REPLY

Please enter your comment!
Please enter your name here