forked from CasualDutchman/Parkitect_CorkscrewCoaster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cs
More file actions
135 lines (113 loc) · 5.11 KB
/
Copy pathMain.cs
File metadata and controls
135 lines (113 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**
* Copyright 2019 Michael Pollind
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
using System.Linq;
using TrackedRiderUtility;
using UnityEngine;
namespace CorkscrewCoaster
{
public class Main : AbstractMod
{
private TrackRiderBinder binder;
private GameObject hider;
public string Path
{
get { return ModManager.Instance.getModEntries().First(x => x.mod == this).path; }
}
private GameObject ProxyObject(GameObject gameObject)
{
gameObject.transform.SetParent(hider.transform);
return gameObject;
}
public override string getName()
{
return "Corkscrew Coaster";
}
public override string getDescription()
{
return "Creates a Corkscrew Coaster";
}
public override string getVersionNumber()
{
return "v1.0.0";
}
public override string getIdentifier()
{
return "CorkscrewCoaster";
}
public override void onEnabled()
{
hider = new GameObject();
hider.SetActive(false);
AssetBundleManager assetBundleManager = new AssetBundleManager(this);
binder = new TrackRiderBinder("kvwQwhKWWG");
var trackedRide =
binder.RegisterTrackedRide<TrackedRide>("Steel Coaster", "CorkscrewCoaster", "Corkscrew Coaster");
var trackGenerator =
binder.RegisterMeshGenerator<TwisterCoasterMeshGenerator>(trackedRide);
TrackRideHelper.PassMeshGeneratorProperties(TrackRideHelper.GetTrackedRide("Steel Coaster").meshGenerator,
trackedRide.meshGenerator);
trackGenerator.crossBeamGO =
GameObjectHelper.SetUV(ProxyObject(Object.Instantiate(assetBundleManager.SideCrossBeamsGo)), 15, 14);
trackedRide.price = 1200;
trackedRide.carTypes = new CoasterCarInstantiator[] { };
trackedRide.meshGenerator.customColors = new[]
{
new Color(63f / 255f, 46f / 255f, 37f / 255f, 1), new Color(43f / 255f, 35f / 255f, 35f / 255f, 1),
new Color(90f / 255f, 90f / 255f, 90f / 255f, 1), new Color(90f / 255f, 90f / 255f, 90f / 255f, 1)
};
trackedRide.dropsImportanceExcitement = 0.665f;
trackedRide.inversionsImportanceExcitement = 0.673f;
trackedRide.averageLatGImportanceExcitement = 0.121f;
trackedRide.accelerationImportanceExcitement = 0.525f;
var coasterCarInstantiator =
binder.RegisterCoasterCarInstaniator<CoasterCarInstantiator>(trackedRide, "CorkscrewCoasterInsantiator",
"Corkscrew Car", 6, 16, 3);
var frontCar = binder.RegisterCar<BaseCar>(ProxyObject(Object.Instantiate(assetBundleManager.FrontCartGo)),
"CorkScrewCoaster_Front_Car",
.35f, 0f, true, new[]
{
new Color(168f / 255, 14f / 255, 14f / 255), new Color(234f / 255, 227f / 255, 227f / 255),
new Color(73f / 255, 73f / 255, 73f / 255)
}
);
coasterCarInstantiator.frontVehicleGO = frontCar;
coasterCarInstantiator.frontVehicleGO.gameObject.AddComponent<RestraintRotationController>().closedAngles =
new Vector3(110, 0, 0);
var transforms = new List<Transform>();
Utility.recursiveFindTransformsStartingWith("wheel", frontCar.transform, transforms);
foreach (var transform in transforms) transform.gameObject.AddComponent<FrictionWheelAnimator>();
var backCar = binder.RegisterCar<BaseCar>(ProxyObject(Object.Instantiate(assetBundleManager.CartGo)),
"CorkScrewCoaster_Back_Car", .35f,
-.3f, false, new[]
{
new Color(168f / 255, 14f / 255, 14f / 255), new Color(234f / 255, 227f / 255, 227f / 255),
new Color(73f / 255, 73f / 255, 73f / 255)
}
);
coasterCarInstantiator.vehicleGO = backCar;
coasterCarInstantiator.vehicleGO.gameObject.AddComponent<RestraintRotationController>().closedAngles =
new Vector3(110, 0, 0);
Utility.recursiveFindTransformsStartingWith("wheel", backCar.transform, transforms);
foreach (var transform in transforms) transform.gameObject.AddComponent<FrictionWheelAnimator>();
binder.Apply();
}
public override void onDisabled()
{
binder.Unload();
}
}
}