H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets/Script/Objective/FXVCollision.cs

27 lines
742 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace FXV
{
/// <summary>
/// 空气墙
/// </summary>
public class FXVCollision : MonoBehaviour
{
public float hitSize = 5.0f;
private void OnTriggerStay(Collider other)
{
if (other.tag == "plane")
{
FXVShield shield = other.gameObject.GetComponentInParent<FXVShield>();
if (shield && !shield.GetIsDuringActivationAnim())
{
Vector3 hitPoint = other.ClosestPoint(this.transform.position);
shield.OnHit(hitPoint, hitSize);
}
}
}
}
}