Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- uses: game-ci/unity-test-runner@main
id: test
with:
unityVersion: '2021.2.2f1'
unityVersion: '2021.2.3f1'
projectPath: VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~
artifactsPath: VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/artifacts
testMode: all
Expand Down
6 changes: 3 additions & 3 deletions VisualPinball.Engine.Test/VisualPinball.Engine.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<AssemblyFileVersion>0.1.0.0</AssemblyFileVersion>
<InformationalVersion>0.1.0.0</InformationalVersion>
<LangVersion>8</LangVersion>
<LangVersion>9.0</LangVersion>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == ''">
Expand All @@ -31,7 +31,7 @@
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0-preview-20211109-03" />
<PackageReference Include="FluentAssertions" Version="5.10.3" ExcludeAssets="Compile" />
<PackageReference Include="FluentAssertions" Version="6.2.0" ExcludeAssets="Compile" />
<PackageReference Include="JeremyAnsel.Media.WavefrontObj" Version="2.0.19" />
</ItemGroup>
<ItemGroup>
Expand All @@ -40,7 +40,7 @@
</ItemGroup>
<ItemGroup>
<Reference Include="FluentAssertions">
<HintPath>$(NuGetPackageRoot)\fluentassertions\5.10.3\lib\net47\FluentAssertions.dll</HintPath>
<HintPath>$(NuGetPackageRoot)\fluentassertions\6.2.0\lib\netstandard2.1\FluentAssertions.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="PluginsDeploy" AfterTargets="Build">
Expand Down
2 changes: 1 addition & 1 deletion VisualPinball.Engine/VisualPinball.Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<AssemblyFileVersion>0.1.0.0</AssemblyFileVersion>
<InformationalVersion>0.1.0.0</InformationalVersion>
<LangVersion>8</LangVersion>
<LangVersion>9.0</LangVersion>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<PackageProjectUrl>https://visualpinball.org</PackageProjectUrl>
<PackageIconUrl>https://user-images.githubusercontent.com/70426/101756172-0965a200-3ad6-11eb-8c71-edb751f0f5d5.png</PackageIconUrl>
Expand Down
2 changes: 1 addition & 1 deletion VisualPinball.Resources/VisualPinball.Resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<AssemblyFileVersion>0.1.0.0</AssemblyFileVersion>
<InformationalVersion>0.1.0.0</InformationalVersion>
<LangVersion>8</LangVersion>
<LangVersion>9.0</LangVersion>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<PackageProjectUrl>https://visualpinball.org</PackageProjectUrl>
<PackageIconUrl>https://user-images.githubusercontent.com/70426/101756172-0965a200-3ad6-11eb-8c71-edb751f0f5d5.png</PackageIconUrl>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ description: VPE supports collisions switches, which turn hittable game objects

# Collision Switches

A Collision Switch turns a hittable game object into a switch device. Example's of hittable game objects are Walls, Rubbers, and Primitives.
A Collision Switch turns a hittable game object into a switch device. Examples of hittable game objects are walls, rubbers, and primitives.

## Setup

To create a Collision Switch:

- Add the Collision Switch directly to a hittable game object. Select the game object you want to add it to, click on *Add Component* in the inspector and select *Visual Pinball -> Mechs -> Collision Switch*.
- Add the collision switch directly to a hittable game object. Select the game object you want to add it to, click on *Add Component* in the inspector and select *Visual Pinball -> Mechs -> Collision Switch*.

To associate the collision switch with a game logic engine switch, use the [Switch Manager](xref:switch_manager) and select the switch in the *Element* column.
<img src="collision-switch-inspector.png" width="323" class="img-responsive pull-right" style="margin-left: 15px">

To associate the collision switch with a game logic engine switch, use the [Switch Manager](xref:switch_manager) and select the switch in the *Element* column:

![Switch Manager](collision-switch-switch-manager.png)

## Runtime

Expand Down
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Burst.dll
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Collections.dll
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Entities.Hybrid.dll
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Entities.dll
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.InputSystem.dll
Binary file not shown.
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Mathematics.Extensions.dll
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Mathematics.dll
Binary file not shown.
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/Unity.Transforms.dll
Binary file not shown.
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/UnityEditor.dll
Binary file not shown.
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified VisualPinball.Unity/Plugins/.unity/UnityEngine.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Visual Pinball Engine
// Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.

// ReSharper disable AssignmentInConditionalExpression

using UnityEditor;
using UnityEngine;

namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(CollisionSwitchComponent)), CanEditMultipleObjects]
public class CollisionSwitchInspector : ItemInspector
{
protected override MonoBehaviour UndoTarget => target as MonoBehaviour;

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

if (Application.isPlaying) {
var tableApi = TableComponent.GetComponent<Player>().TableApi;
var switchApi = tableApi.Switchable((MonoBehaviour)target);

if (switchApi is CollisionSwitchApi { IsHittable: true }) {
DrawSwitch($"Collision switch exposed as {target.name}.", switchApi.IsSwitchEnabled);
}
else {
GUILayout.Label($"Collision switch not connected to hittable.");
}
}
else {
GUILayout.Label($"Collision switch will be exposed as {target.name}.");
}
}

private static void DrawSwitch(string label, bool sw)
{
var labelPos = EditorGUILayout.GetControlRect();
labelPos.height = 18;

var icon = Icons.Switch(sw, IconSize.Small, sw ? IconColor.Orange : IconColor.Gray);
var width = ((labelPos.height / icon.height) * icon.width) + 2;

labelPos.x += width;
labelPos.width -= width;

var switchPos = new Rect(labelPos.x - width, labelPos.y, labelPos.height, labelPos.height);
GUI.Label(labelPos, label);
GUI.DrawTexture(switchPos, icon);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public class DropTargetBankInspector : ItemInspector
"3 Bank",
"4 Bank",
"5 Bank",
"6 Bank"
"6 Bank",
"7 Bank",
"8 Bank",
"9 Bank",
"10 Bank"
};

private static readonly int[] BankSizeValues = {
Expand All @@ -39,15 +43,19 @@ public class DropTargetBankInspector : ItemInspector
3,
4,
5,
6
6,
7,
8,
9,
10
};

private bool _togglePlayfield = true;

private SerializedProperty _bankSizeProperty;
private SerializedProperty _dropTargetsProperty;

protected override MonoBehaviour UndoTarget => throw new System.NotImplementedException();
protected override MonoBehaviour UndoTarget => target as MonoBehaviour;

override protected void OnEnable()
{
Expand Down Expand Up @@ -186,8 +194,8 @@ private static void DrawSwitch(string label, bool sw)
var width = ((labelPos.height / icon.height) * icon.width) + 2;

labelPos.x += width;
labelPos.width -= width;
labelPos.width -= width;

var switchPos = new Rect(labelPos.x - width, labelPos.y, labelPos.height, labelPos.height);
GUI.Label(labelPos, label);
GUI.DrawTexture(switchPos, icon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public Texture2D Lookup<T>(T mb, IconSize size = IconSize.Large, IconColor color
case TeleporterComponent _: return Icons.Teleporter(size, color);
case TriggerComponent _: return Icons.Trigger(size, color);
case TroughComponent _: return Icons.Trough(size, color);
case CollisionSwitchComponent _: return Icons.Switch(false, size, color);
default: return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<Title>VisualPinball.Unity.Editor</Title>
<Description>A bridge between VisualPinball.Engine and Unity</Description>
<Authors>freezy;ravarcade;shaderbytes;rbxnk;jsm174;Vroonsh;Rowlan;kleisauke;ecurtz;Pandeli</Authors>
<Copyright>Copyright 2021 freezy - &lt;freezy@vpdb.io&gt;</Copyright>
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<AssemblyFileVersion>0.1.0.0</AssemblyFileVersion>
<InformationalVersion>0.1.0.0</InformationalVersion>
<LangVersion>8</LangVersion>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="**/*.meta" Visible="false" />
Expand All @@ -31,6 +31,9 @@
<Reference Include="UnityEditor">
<HintPath>..\Plugins\.unity\UnityEditor.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.CoreModule">
<HintPath>..\Plugins\.unity\UnityEditor.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>..\Plugins\.unity\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
Expand All @@ -40,7 +43,7 @@
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\Plugins\.unity\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnitEngine.InputSystem">
<Reference Include="UnityEngine.InputSystem">
<HintPath>..\Plugins\.unity\Unity.InputSystem.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
Expand Down
Loading