Был сделан Build

This commit is contained in:
Max_Divizion 2024-06-18 17:19:55 +03:00
parent cd6e0e46c6
commit 5d74581f3c
4 changed files with 53 additions and 59 deletions

View File

@ -1,19 +1,11 @@
//----------------------------------------------
// Realistic Car Controller
//
// Copyright © 2014 - 2023 BoneCracker Games
// https://www.bonecrackergames.com
// Buğra Özdoğanlar
//
//----------------------------------------------
using UnityEngine;
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
public class RCC_EditorWindows : Editor {
public class RCC_EditorWindows : Editor
{
private static RCC_CarControllerV3 SelectedCar() {

Binary file not shown.

View File

@ -1,61 +1,63 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
//using UnityEngine;
//using UnityEditor;
//using System.Collections;
class BoxyCarWizard : EditorWindow {
private int axlesCount = 2;
private float mass = 1000;
private float axleStep = 2;
private float axleWidth = 2;
private float axleShift = -0.5f;
//class BoxyCarWizard : EditorWindow
//{
// private int axlesCount = 2;
// private float mass = 1000;
// private float axleStep = 2;
// private float axleWidth = 2;
// private float axleShift = -0.5f;
[MenuItem ("Vehicles/Boxy car wizard")]
public static void ShowWindow () {
EditorWindow.GetWindow(typeof(BoxyCarWizard));
}
// //[MenuItem("Vehicles/Boxy car wizard")]
// public static void ShowWindow()
// {
// EditorWindow.GetWindow(typeof(BoxyCarWizard));
// }
void OnGUI () {
axlesCount = EditorGUILayout.IntSlider ("Axles: ", axlesCount, 2, 10);
mass = EditorGUILayout.FloatField ("Mass: ", mass);
axleStep = EditorGUILayout.FloatField ("Axle step: ", axleStep);
axleWidth = EditorGUILayout.FloatField ("Axle width: ", axleWidth);
axleShift = EditorGUILayout.FloatField ("Axle shift: ", axleShift);
// void OnGUI () {
// axlesCount = EditorGUILayout.IntSlider ("Axles: ", axlesCount, 2, 10);
// mass = EditorGUILayout.FloatField ("Mass: ", mass);
// axleStep = EditorGUILayout.FloatField ("Axle step: ", axleStep);
// axleWidth = EditorGUILayout.FloatField ("Axle width: ", axleWidth);
// axleShift = EditorGUILayout.FloatField ("Axle shift: ", axleShift);
if (GUILayout.Button("Generate")) {
CreateCar ();
}
}
// if (GUILayout.Button("Generate")) {
// CreateCar ();
// }
// }
void CreateCar()
{
var root = new GameObject ("carRoot");
var rootBody = root.AddComponent<Rigidbody> ();
rootBody.mass = mass;
// void CreateCar()
// {
// var root = new GameObject ("carRoot");
// var rootBody = root.AddComponent<Rigidbody> ();
// rootBody.mass = mass;
var body = GameObject.CreatePrimitive (PrimitiveType.Cube);
body.transform.parent = root.transform;
// var body = GameObject.CreatePrimitive (PrimitiveType.Cube);
// body.transform.parent = root.transform;
float length = (axlesCount - 1) * axleStep;
float firstOffset = length / 2;
// float length = (axlesCount - 1) * axleStep;
// 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)
{
var leftWheel = new GameObject (string.Format("a{0}l", i));
var rightWheel = new GameObject (string.Format("a{0}r", i));
// for (int i = 0; i < axlesCount; ++i)
// {
// var leftWheel = new GameObject (string.Format("a{0}l", i));
// var rightWheel = new GameObject (string.Format("a{0}r", i));
leftWheel.AddComponent<WheelCollider> ();
rightWheel.AddComponent<WheelCollider> ();
// leftWheel.AddComponent<WheelCollider> ();
// rightWheel.AddComponent<WheelCollider> ();
leftWheel.transform.parent = root.transform;
rightWheel.transform.parent = root.transform;
// leftWheel.transform.parent = root.transform;
// rightWheel.transform.parent = root.transform;
leftWheel.transform.localPosition = new Vector3 (-axleWidth / 2, axleShift, firstOffset - axleStep * i);
rightWheel.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);
// }
root.AddComponent<EasySuspension>();
root.AddComponent<RearWheelDrive>();
}
}
// root.AddComponent<EasySuspension>();
// root.AddComponent<RearWheelDrive>();
// }
//}