32 lines
807 B
C#
32 lines
807 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// ·ÕÏ
|
|
/// </summary>
|
|
public class Roadblock : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// ¸ÕÌå
|
|
/// </summary>
|
|
public Rigidbody rb;
|
|
|
|
private void OnEnable()
|
|
{
|
|
rb.velocity = Vector3.zero;
|
|
}
|
|
|
|
/// <summary>
|
|
/// »÷·É
|
|
/// </summary>
|
|
public void ShootFly(Transform transform)
|
|
{
|
|
rb.useGravity = true;
|
|
rb.isKinematic = false;
|
|
rb.AddForce((transform.position - this.transform.position).normalized * -100, ForceMode.Impulse);
|
|
rb.AddForce(Vector3.up * 20, ForceMode.Impulse);
|
|
rb.AddTorque(new Vector3(Random.Range(-180, 180), Random.Range(-180, 180), Random.Range(-180, 180)), ForceMode.Impulse);
|
|
}
|
|
}
|