Был сделан Build
This commit is contained in:
parent
cd6e0e46c6
commit
5d74581f3c
@ -1,19 +1,11 @@
|
|||||||
//----------------------------------------------
|
using UnityEngine;
|
||||||
// Realistic Car Controller
|
|
||||||
//
|
|
||||||
// Copyright © 2014 - 2023 BoneCracker Games
|
|
||||||
// https://www.bonecrackergames.com
|
|
||||||
// Buğra Özdoğanlar
|
|
||||||
//
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public class RCC_EditorWindows : Editor {
|
public class RCC_EditorWindows : Editor
|
||||||
|
{
|
||||||
|
|
||||||
private static RCC_CarControllerV3 SelectedCar() {
|
private static RCC_CarControllerV3 SelectedCar() {
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,61 +1,63 @@
|
|||||||
using UnityEngine;
|
//using UnityEngine;
|
||||||
using UnityEditor;
|
//using UnityEditor;
|
||||||
using System.Collections;
|
//using System.Collections;
|
||||||
|
|
||||||
class BoxyCarWizard : EditorWindow {
|
//class BoxyCarWizard : EditorWindow
|
||||||
private int axlesCount = 2;
|
//{
|
||||||
private float mass = 1000;
|
// private int axlesCount = 2;
|
||||||
private float axleStep = 2;
|
// private float mass = 1000;
|
||||||
private float axleWidth = 2;
|
// private float axleStep = 2;
|
||||||
private float axleShift = -0.5f;
|
// private float axleWidth = 2;
|
||||||
|
// private float axleShift = -0.5f;
|
||||||
|
|
||||||
[MenuItem ("Vehicles/Boxy car wizard")]
|
// //[MenuItem("Vehicles/Boxy car wizard")]
|
||||||
public static void ShowWindow () {
|
// public static void ShowWindow()
|
||||||
EditorWindow.GetWindow(typeof(BoxyCarWizard));
|
// {
|
||||||
}
|
// EditorWindow.GetWindow(typeof(BoxyCarWizard));
|
||||||
|
// }
|
||||||
|
|
||||||
void OnGUI () {
|
// void OnGUI () {
|
||||||
axlesCount = EditorGUILayout.IntSlider ("Axles: ", axlesCount, 2, 10);
|
// axlesCount = EditorGUILayout.IntSlider ("Axles: ", axlesCount, 2, 10);
|
||||||
mass = EditorGUILayout.FloatField ("Mass: ", mass);
|
// mass = EditorGUILayout.FloatField ("Mass: ", mass);
|
||||||
axleStep = EditorGUILayout.FloatField ("Axle step: ", axleStep);
|
// axleStep = EditorGUILayout.FloatField ("Axle step: ", axleStep);
|
||||||
axleWidth = EditorGUILayout.FloatField ("Axle width: ", axleWidth);
|
// axleWidth = EditorGUILayout.FloatField ("Axle width: ", axleWidth);
|
||||||
axleShift = EditorGUILayout.FloatField ("Axle shift: ", axleShift);
|
// axleShift = EditorGUILayout.FloatField ("Axle shift: ", axleShift);
|
||||||
|
|
||||||
if (GUILayout.Button("Generate")) {
|
// if (GUILayout.Button("Generate")) {
|
||||||
CreateCar ();
|
// CreateCar ();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void CreateCar()
|
// void CreateCar()
|
||||||
{
|
// {
|
||||||
var root = new GameObject ("carRoot");
|
// var root = new GameObject ("carRoot");
|
||||||
var rootBody = root.AddComponent<Rigidbody> ();
|
// var rootBody = root.AddComponent<Rigidbody> ();
|
||||||
rootBody.mass = mass;
|
// rootBody.mass = mass;
|
||||||
|
|
||||||
var body = GameObject.CreatePrimitive (PrimitiveType.Cube);
|
// var body = GameObject.CreatePrimitive (PrimitiveType.Cube);
|
||||||
body.transform.parent = root.transform;
|
// body.transform.parent = root.transform;
|
||||||
|
|
||||||
float length = (axlesCount - 1) * axleStep;
|
// float length = (axlesCount - 1) * axleStep;
|
||||||
float firstOffset = length / 2;
|
// float firstOffset = length / 2;
|
||||||
|
|
||||||
body.transform.localScale = new Vector3(axleWidth, 1, length);
|
// body.transform.localScale = new Vector3(axleWidth, 1, length);
|
||||||
|
|
||||||
for (int i = 0; i < axlesCount; ++i)
|
// for (int i = 0; i < axlesCount; ++i)
|
||||||
{
|
// {
|
||||||
var leftWheel = new GameObject (string.Format("a{0}l", i));
|
// var leftWheel = new GameObject (string.Format("a{0}l", i));
|
||||||
var rightWheel = new GameObject (string.Format("a{0}r", i));
|
// var rightWheel = new GameObject (string.Format("a{0}r", i));
|
||||||
|
|
||||||
leftWheel.AddComponent<WheelCollider> ();
|
// leftWheel.AddComponent<WheelCollider> ();
|
||||||
rightWheel.AddComponent<WheelCollider> ();
|
// rightWheel.AddComponent<WheelCollider> ();
|
||||||
|
|
||||||
leftWheel.transform.parent = root.transform;
|
// leftWheel.transform.parent = root.transform;
|
||||||
rightWheel.transform.parent = root.transform;
|
// rightWheel.transform.parent = root.transform;
|
||||||
|
|
||||||
leftWheel.transform.localPosition = new Vector3 (-axleWidth / 2, axleShift, firstOffset - axleStep * i);
|
// leftWheel.transform.localPosition = new Vector3 (-axleWidth / 2, axleShift, firstOffset - axleStep * i);
|
||||||
rightWheel.transform.localPosition = new Vector3 (axleWidth / 2, axleShift, firstOffset - axleStep * i);
|
// rightWheel.transform.localPosition = new Vector3 (axleWidth / 2, axleShift, firstOffset - axleStep * i);
|
||||||
}
|
// }
|
||||||
|
|
||||||
root.AddComponent<EasySuspension>();
|
// root.AddComponent<EasySuspension>();
|
||||||
root.AddComponent<RearWheelDrive>();
|
// root.AddComponent<RearWheelDrive>();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user