diff --git a/VisualPinball.Engine/VPT/ItemType.cs b/VisualPinball.Engine/VPT/ItemType.cs
index 6546da8aa..73f69f1f7 100644
--- a/VisualPinball.Engine/VPT/ItemType.cs
+++ b/VisualPinball.Engine/VPT/ItemType.cs
@@ -49,7 +49,8 @@ public enum ItemType
Flasher = 20,
Rubber = 21,
HitTarget = 22,
- Count = 23,
+ Trough = 23,
+ Count = 24,
Invalid = -1,
// VPE internal
diff --git a/VisualPinball.Engine/VPT/Trough.meta b/VisualPinball.Engine/VPT/Trough.meta
new file mode 100644
index 000000000..d0ffa86e7
--- /dev/null
+++ b/VisualPinball.Engine/VPT/Trough.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3fd1432f7bc694b779c7e8e0d9018022
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Engine/VPT/Trough/Trough.cs b/VisualPinball.Engine/VPT/Trough/Trough.cs
new file mode 100644
index 000000000..e90437187
--- /dev/null
+++ b/VisualPinball.Engine/VPT/Trough/Trough.cs
@@ -0,0 +1,58 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using System.IO;
+using VisualPinball.Engine.Game;
+using VisualPinball.Engine.Math;
+
+namespace VisualPinball.Engine.VPT.Trough
+{
+ public class Trough : Item, IRenderable
+ {
+ public override string ItemName { get; } = "Trough";
+ public override string ItemGroupName { get; } = "Troughs";
+
+ public Vertex3D Position { get => Vertex3D.Zero; set { } }
+ public float RotationY { get => 0f; set { } }
+
+ public Trough(TroughData data) : base(data)
+ {
+ }
+
+ public Trough(BinaryReader reader, string itemName) : this(new TroughData(reader, itemName))
+ {
+ }
+
+ #region IRenderable
+
+ Matrix3D IRenderable.TransformationMatrix(Table.Table table, Origin origin)
+ {
+ return Matrix3D.Identity;
+ }
+
+ public RenderObject GetRenderObject(Table.Table table, string id = null, Origin origin = Origin.Global, bool asRightHanded = true)
+ {
+ return null;
+ }
+
+ public RenderObjectGroup GetRenderObjects(Table.Table table, Origin origin = Origin.Global, bool asRightHanded = true)
+ {
+ return new RenderObjectGroup(Data.Name, "trough", Math.Matrix3D.Identity, new RenderObject[0]);
+ }
+
+ #endregion
+ }
+}
diff --git a/VisualPinball.Engine/VPT/Trough/Trough.cs.meta b/VisualPinball.Engine/VPT/Trough/Trough.cs.meta
new file mode 100644
index 000000000..c25340d05
--- /dev/null
+++ b/VisualPinball.Engine/VPT/Trough/Trough.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 359e5a55a56254a68931446a9b6d6e9a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Engine/VPT/Trough/TroughData.cs b/VisualPinball.Engine/VPT/Trough/TroughData.cs
new file mode 100644
index 000000000..080ae3d22
--- /dev/null
+++ b/VisualPinball.Engine/VPT/Trough/TroughData.cs
@@ -0,0 +1,83 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+#region ReSharper
+// ReSharper disable UnassignedField.Global
+// ReSharper disable StringLiteralTypo
+// ReSharper disable FieldCanBeMadeReadOnly.Global
+// ReSharper disable ConvertToConstant.Global
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using VisualPinball.Engine.IO;
+using VisualPinball.Engine.Math;
+using VisualPinball.Engine.VPT.Table;
+
+namespace VisualPinball.Engine.VPT.Trough
+{
+ [Serializable]
+ public class TroughData : ItemData
+ {
+ public override string GetName() => Name;
+ public override void SetName(string name) { Name = name; }
+
+ [BiffString("NAME", IsWideString = true, Pos = 9)]
+ public string Name;
+
+ [BiffString("ENTK", Pos = 1)]
+ public string EntryKicker = string.Empty;
+
+ [BiffString("ENTS", Pos = 2)]
+ public string EntrySwitch = string.Empty;
+
+ [BiffString("EXIT", Pos = 10)]
+ public string ExitKicker = string.Empty;
+
+ [BiffInt("BCNT", Pos = 3)]
+ public int BallCount = 3;
+
+ [BiffInt("SCNT", Pos = 4)]
+ public int SwitchCount = 3;
+
+ [BiffFloat("TIME", Pos = 5)]
+ public float SettleTime = 0.1f;
+
+ #region BIFF
+
+ static TroughData()
+ {
+ Init(typeof(TroughData), Attributes);
+ }
+
+ public TroughData(BinaryReader reader, string storageName) : base(storageName)
+ {
+ Load(this, reader, Attributes);
+ }
+
+ public override void Write(BinaryWriter writer, HashWriter hashWriter)
+ {
+ writer.Write((int)ItemType.Trough);
+ WriteRecord(writer, Attributes, hashWriter);
+ WriteEnd(writer, hashWriter);
+ }
+
+ private static readonly Dictionary> Attributes = new Dictionary>();
+
+ #endregion
+ }
+}
diff --git a/VisualPinball.Engine/VPT/Trough/TroughData.cs.meta b/VisualPinball.Engine/VPT/Trough/TroughData.cs.meta
new file mode 100644
index 000000000..6de4b2d57
--- /dev/null
+++ b/VisualPinball.Engine/VPT/Trough/TroughData.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 23d7577ef803444a88c18204c09da04b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs
index 76f87c917..97f9b238b 100644
--- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/ItemInspector.cs
@@ -18,7 +18,9 @@
using System.Linq;
using UnityEditor;
using UnityEngine;
+using VisualPinball.Engine.Game;
using VisualPinball.Engine.Math;
+using VisualPinball.Engine.VPT;
using VisualPinball.Engine.VPT.Surface;
namespace VisualPinball.Unity.Editor
@@ -28,7 +30,7 @@ public abstract class ItemInspector : UnityEditor.Editor
public abstract MonoBehaviour UndoTarget { get; }
private TableAuthoring _table;
- private SurfaceAuthoring _surface;
+ private MonoBehaviour _item;
private string[] _allMaterials = new string[0];
private string[] _allTextures = new string[0];
@@ -238,28 +240,35 @@ protected void ItemDataField(string label, ref Engine.Math.Color field, bool dir
}
}
- protected void SurfaceField(string label, ref string field, bool dirtyMesh = true)
+ protected void ItemReferenceField(string label, ref string field, bool dirtyMesh = true)
+ where TItemAuthoring : ItemMainAuthoring
+ where TData : ItemData where TItem : Item, IRenderable
{
- if (_surface?.name != field) {
- _surface = null;
+ if (_item?.name != field) {
+ _item = null;
}
- if (_surface == null && _table != null) {
- var currentFieldName = field;
- if (currentFieldName != null && _table.Table.Has(currentFieldName)) {
- _surface = _table.gameObject.GetComponentsInChildren(true)
+ if (_item == null && _table != null) {
+ string currentFieldName = field;
+ if (currentFieldName != null && _table.Table.Has(currentFieldName)) {
+ _item = _table.gameObject.GetComponentsInChildren(true)
.FirstOrDefault(s => s.name == currentFieldName);
}
}
EditorGUI.BeginChangeCheck();
- _surface = (SurfaceAuthoring)EditorGUILayout.ObjectField(label, _surface, typeof(SurfaceAuthoring), true);
+ _item = (TItemAuthoring)EditorGUILayout.ObjectField(label, _item, typeof(TItemAuthoring), true);
if (EditorGUI.EndChangeCheck()) {
FinishEdit(label, dirtyMesh);
- field = _surface != null ? _surface.name : string.Empty;
+ field = _item != null ? _item.name : string.Empty;
}
}
+ protected void SurfaceField(string label, ref string field, bool dirtyMesh = true)
+ {
+ ItemReferenceField(label, ref field, dirtyMesh);
+ }
+
protected void DropDownField(string label, ref T field, string[] optionStrings, T[] optionValues, bool dirtyMesh = true, Action onChanged = null) where T : IEquatable
{
if (optionStrings == null || optionValues == null || optionStrings.Length != optionValues.Length) {
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough.meta b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough.meta
new file mode 100644
index 000000000..b05a3a372
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6cdfb1a219ee5483aa2b17ed44f398d6
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough/TroughInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough/TroughInspector.cs
new file mode 100644
index 000000000..a749a38ad
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough/TroughInspector.cs
@@ -0,0 +1,57 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using UnityEditor;
+using VisualPinball.Unity;
+using VisualPinball.Engine.VPT.Trough;
+using VisualPinball.Engine.VPT.Kicker;
+
+namespace VisualPinball.Unity.Editor
+{
+ [CustomEditor(typeof(TroughAuthoring))]
+ public class TroughInspector : ItemMainInspector
+ {
+ private TroughAuthoring _trough;
+ private bool _foldoutPosition = true;
+ private bool _foldoutMisc = true;
+
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+ _trough = target as TroughAuthoring;
+ }
+
+ public override void OnInspectorGUI()
+ {
+ OnPreInspectorGUI();
+
+ if (_foldoutPosition = EditorGUILayout.BeginFoldoutHeaderGroup(_foldoutPosition, "Position")) {
+ ItemReferenceField("Entry Kicker", ref _trough.Data.EntryKicker);
+ ItemReferenceField("Exit Kicker", ref _trough.Data.ExitKicker);
+ }
+ EditorGUILayout.EndFoldoutHeaderGroup();
+
+ if (_foldoutMisc = EditorGUILayout.BeginFoldoutHeaderGroup(_foldoutMisc, "Misc")) {
+ ItemDataField("Max Balls", ref _trough.Data.BallCount, dirtyMesh: false);
+ ItemDataField("Switch Count", ref _trough.Data.SwitchCount, dirtyMesh: false);
+ ItemDataField("Settle Time", ref _trough.Data.SettleTime, dirtyMesh: false);
+ }
+ EditorGUILayout.EndFoldoutHeaderGroup();
+
+ base.OnInspectorGUI();
+ }
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough/TroughInspector.cs.meta b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough/TroughInspector.cs.meta
new file mode 100644
index 000000000..5f04f1680
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Trough/TroughInspector.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f921351c72e0e4f6f99bbbf5bc8be9fa
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity/Game/Player.cs b/VisualPinball.Unity/VisualPinball.Unity/Game/Player.cs
index 749418438..742cf15a5 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/Game/Player.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/Game/Player.cs
@@ -37,6 +37,7 @@
using VisualPinball.Engine.VPT.Surface;
using VisualPinball.Engine.VPT.Table;
using VisualPinball.Engine.VPT.Trigger;
+using VisualPinball.Engine.VPT.Trough;
using Logger = NLog.Logger;
namespace VisualPinball.Unity
@@ -44,6 +45,7 @@ namespace VisualPinball.Unity
public class Player : MonoBehaviour
{
public Table Table { get; private set; }
+ public TableApi TableApi { get { return _tableApi; } }
// shortcuts
public Matrix4x4 TableToWorld => transform.localToWorldMatrix;
@@ -258,6 +260,12 @@ public void RegisterTrigger(Trigger trigger, Entity entity, GameObject go)
_switches[trigger.Name] = triggerApi;
}
+ public void RegisterTrough(Trough trough, Entity entity, GameObject go)
+ {
+ var troughApi = new TroughApi(trough, entity, this);
+ _initializables.Add(troughApi);
+ }
+
#endregion
#region Mapping
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/ItemApi.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/ItemApi.cs
index 032aa22e8..41845acfc 100644
--- a/VisualPinball.Unity/VisualPinball.Unity/VPT/ItemApi.cs
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/ItemApi.cs
@@ -30,6 +30,7 @@ public abstract class ItemApi : IApi where T : Item where TData
protected TData Data => Item.Data;
protected Table Table => _player.Table;
+ protected TableApi TableApi => _player.TableApi;
protected readonly EntityManager EntityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough.meta b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough.meta
new file mode 100644
index 000000000..61ae11faf
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 975c786b0dfc94e5085f535e38e194fa
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughApi.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughApi.cs
new file mode 100644
index 000000000..4ef9cee08
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughApi.cs
@@ -0,0 +1,70 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using System;
+using Unity.Entities;
+using VisualPinball.Engine.VPT.Trough;
+
+namespace VisualPinball.Unity
+{
+ public class TroughApi : ItemApi,
+ IApiInitializable
+ {
+ private KickerApi _entryKicker;
+ private KickerApi _exitKicker;
+
+ ///
+ /// Event emitted when the table is started.
+ ///
+ public event EventHandler Init;
+
+ internal TroughApi(Trough item, Entity entity, Player player) : base(item, entity, player)
+ {
+ }
+
+ #region Events
+
+ void IApiInitializable.OnInit(BallManager ballManager)
+ {
+ _entryKicker = TableApi.Kicker(Data.EntryKicker);
+ _exitKicker = TableApi.Kicker(Data.ExitKicker);
+
+ if (_entryKicker != null)
+ {
+ _entryKicker.Hit += OnEntryKickerHit;
+ }
+
+ if (_exitKicker != null)
+ {
+ _exitKicker.Hit += OnExitKickerFire;
+ }
+
+ Init?.Invoke(this, EventArgs.Empty);
+ }
+
+ void OnEntryKickerHit(object sender, EventArgs args)
+ {
+ (sender as KickerApi)?.DestroyBall();
+ }
+
+ void OnExitKickerFire(object sender, EventArgs args)
+ {
+ (sender as KickerApi)?.CreateBall();
+ }
+
+ #endregion
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughApi.cs.meta b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughApi.cs.meta
new file mode 100644
index 000000000..e0d3099e8
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughApi.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4020d37ef294341f0b853a9dadccb9a9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughAuthoring.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughAuthoring.cs
new file mode 100644
index 000000000..bba2c920d
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughAuthoring.cs
@@ -0,0 +1,75 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+#region ReSharper
+// ReSharper disable CompareOfFloatsByEqualityOperator
+// ReSharper disable ClassNeverInstantiated.Global
+// ReSharper disable MemberCanBePrivate.Global
+#endregion
+
+using System;
+using System.Collections.Generic;
+using Unity.Entities;
+using UnityEngine;
+using VisualPinball.Engine.VPT.Trough;
+
+namespace VisualPinball.Unity
+{
+ [ExecuteAlways]
+ [AddComponentMenu("Visual Pinball/Trough")]
+ public class TroughAuthoring : ItemMainAuthoring, IConvertGameObjectToEntity
+ {
+ protected override Trough InstantiateItem(TroughData data) => new Trough(data);
+
+ protected override Type MeshAuthoringType { get; } = null;
+ protected override Type ColliderAuthoringType { get; } = null;
+
+ public override IEnumerable ValidParents => new Type[0];
+
+ public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
+ {
+ Convert(entity, dstManager);
+
+ dstManager.AddComponentData(entity, new TroughStaticData
+ {
+ BallCount = Data.BallCount,
+ SwitchCount = Data.SwitchCount,
+ SettleTime = Data.SettleTime
+ });
+
+ // register
+ transform.GetComponentInParent().RegisterTrough(Item, entity, gameObject);
+ }
+
+ public override void Restore()
+ {
+ // update the name
+ Item.Name = name;
+ }
+
+ //public override ItemDataTransformType EditorPositionType => ItemDataTransformType.TwoD;
+ //public override Vector3 GetEditorPosition() => data.Entrance.ToUnityVector3(0f);
+ //public override void SetEditorPosition(Vector3 pos) => data.Entrance = pos.ToVertex2Dxy();
+
+ //public override ItemDataTransformType EditorRotationType => ItemDataTransformType.OneD;
+ //public override Vector3 GetEditorRotation() => new Vector3(data.Orientation, 0, 0);
+ //public override void SetEditorRotation(Vector3 rot) => data.Orientation = rot.x;
+
+ //public override ItemDataTransformType EditorScaleType => ItemDataTransformType.OneD;
+ //public override Vector3 GetEditorScale() => new Vector3(data.ExitOffset, 0f, 0f);
+ //public override void SetEditorScale(Vector3 scale) => data.ExitOffset = scale.x;
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughAuthoring.cs.meta b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughAuthoring.cs.meta
new file mode 100644
index 000000000..5041f2d42
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughAuthoring.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 467487a171ee448a5b826714ef66c3ed
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: f9918981bd2cf4e179f31abf058bb4a5, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughExtensions.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughExtensions.cs
new file mode 100644
index 000000000..164188d84
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughExtensions.cs
@@ -0,0 +1,32 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using Unity.Entities;
+using UnityEngine;
+using VisualPinball.Engine.Game;
+
+namespace VisualPinball.Unity
+{
+ internal static class TroughExtensions
+ {
+ public static TroughAuthoring SetupGameObject(this Engine.VPT.Trough.Trough Trough, GameObject obj, RenderObjectGroup rog)
+ {
+ var ic = obj.AddComponent().SetItem(Trough);
+ obj.AddComponent();
+ return ic as TroughAuthoring;
+ }
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughExtensions.cs.meta b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughExtensions.cs.meta
new file mode 100644
index 000000000..5cc93bac9
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f92811f35ae2d479cb785222f9e19832
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughStaticData.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughStaticData.cs
new file mode 100644
index 000000000..fea127129
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughStaticData.cs
@@ -0,0 +1,30 @@
+// Visual Pinball Engine
+// Copyright (C) 2020 freezy and VPE Team
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using Unity.Entities;
+
+namespace VisualPinball.Unity
+{
+ internal struct TroughStaticData : IComponentData
+ {
+ public Entity EntrySwitch;
+ public Entity EntryKicker;
+ public Entity ExitKicker;
+ public int BallCount;
+ public int SwitchCount;
+ public float SettleTime;
+ }
+}
diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughStaticData.cs.meta b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughStaticData.cs.meta
new file mode 100644
index 000000000..84b238a5d
--- /dev/null
+++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trough/TroughStaticData.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c4aafd68e91904edebd1ff37bb96b3fb
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: