Первый коммит

This commit is contained in:
2024-04-20 11:16:35 +03:00
parent 284e0891d9
commit 2452b24ee5
5427 changed files with 4562744 additions and 0 deletions

View File

@ -0,0 +1,48 @@
//----------------------------------------------
// Realistic Car Controller
//
// Copyright © 2014 - 2023 BoneCracker Games
// https://www.bonecrackergames.com
// Buğra Özdoğanlar
//
//----------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Trailer attacher point. Trailer will be attached when two trigger colliders triggers each other.
/// </summary>
[AddComponentMenu("BoneCracker Games/Realistic Car Controller/Misc/RCC Trailer Attacher")]
public class RCC_TrailerAttachPoint : MonoBehaviour {
private void OnTriggerEnter(Collider col) {
// Getting other attacher.
RCC_TrailerAttachPoint otherAttacher = col.gameObject.GetComponent<RCC_TrailerAttachPoint>();
// If no attacher found, return.
if (!otherAttacher)
return;
// Other vehicle.
RCC_CarControllerV3 otherVehicle = otherAttacher.gameObject.GetComponentInParent<RCC_CarControllerV3>();
// If no vehicle found, return.
if (!otherVehicle)
return;
// Attach the trailer.
GetComponentInParent<ConfigurableJoint>().transform.SendMessage("AttachTrailer", otherVehicle, SendMessageOptions.DontRequireReceiver);
}
private void Reset() {
if (GetComponent<BoxCollider>() == null)
gameObject.AddComponent<BoxCollider>().isTrigger = true;
}
}