Skip to content
Snippets Groups Projects
Commit 1246657b authored by mariuskern's avatar mariuskern
Browse files

new gadget

parent 588469d3
Branches
No related tags found
No related merge requests found
...@@ -27,7 +27,8 @@ MonoBehaviour: ...@@ -27,7 +27,8 @@ MonoBehaviour:
- {fileID: 21300000, guid: d456617ba2282854d9570dcebcc2b279, type: 3} - {fileID: 21300000, guid: d456617ba2282854d9570dcebcc2b279, type: 3}
- {fileID: 21300000, guid: e35797aede3d7bd449ca9195a409b0cc, type: 3} - {fileID: 21300000, guid: e35797aede3d7bd449ca9195a409b0cc, type: 3}
- {fileID: 21300000, guid: 9831128faf2531e4cba52f58894091be, type: 3} - {fileID: 21300000, guid: 9831128faf2531e4cba52f58894091be, type: 3}
GadgetType: ffffffff00000000010000000200000003000000040000000500000006000000070000000800000009000000 - {fileID: 21300000, guid: e706f1d2fb068e342b1c80c357d84b40, type: 3}
GadgetType: ffffffff000000000100000002000000030000000400000005000000060000000700000008000000090000000a000000
GadgetData: GadgetData:
- {fileID: 11400000, guid: 7431ff31b707d2a4082b65b61e15e5df, type: 2} - {fileID: 11400000, guid: 7431ff31b707d2a4082b65b61e15e5df, type: 2}
- {fileID: 11400000, guid: c149a1e468d3b3b48a0732c2e0811856, type: 2} - {fileID: 11400000, guid: c149a1e468d3b3b48a0732c2e0811856, type: 2}
...@@ -40,3 +41,4 @@ MonoBehaviour: ...@@ -40,3 +41,4 @@ MonoBehaviour:
- {fileID: 11400000, guid: 06736b134e21b50488990025c33c9c2e, type: 2} - {fileID: 11400000, guid: 06736b134e21b50488990025c33c9c2e, type: 2}
- {fileID: 11400000, guid: 6bc4e283502549d428d3c9ce74e91757, type: 2} - {fileID: 11400000, guid: 6bc4e283502549d428d3c9ce74e91757, type: 2}
- {fileID: 11400000, guid: 35d3197399dc8374280464a237271ac5, type: 2} - {fileID: 11400000, guid: 35d3197399dc8374280464a237271ac5, type: 2}
- {fileID: 11400000, guid: 9c857513d338e4549ad22b712627eda6, type: 2}
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 262a3c8caea4a7741b65ef20c568f5c2, type: 3}
m_Name: TestGadgetDataContainerGadgetInit
m_EditorClassIdentifier: Assembly-CSharp::DataContainerGadgetInit
Rank: 0
MaxRange: Infinity
MaxHeight: Infinity
UiName: Test Gadget
MaterialIndx: 0
ButtonIndx: 11
LayerHitMask:
serializedVersion: 2
m_Bits: 1581105
SecondaryLayerMask:
serializedVersion: 2
m_Bits: 0
fileFormatVersion: 2
guid: 9c857513d338e4549ad22b712627eda6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
/// </summary> /// </summary>
[JsonConverter(typeof(JsonSubtypes), "s_type")] [JsonConverter(typeof(JsonSubtypes), "s_type")]
[JsonSubtypes.KnownSubType(typeof(Pointer), "Pointer")] [JsonSubtypes.KnownSubType(typeof(Pointer), "Pointer")]
[JsonSubtypes.KnownSubType(typeof(TestGadget), "TestGadget")]
[JsonSubtypes.KnownSubType(typeof(Tape), "Tape")] [JsonSubtypes.KnownSubType(typeof(Tape), "Tape")]
[JsonSubtypes.KnownSubType(typeof(LineTool), "LineTool")] [JsonSubtypes.KnownSubType(typeof(LineTool), "LineTool")]
[JsonSubtypes.KnownSubType(typeof(LotTool), "LotTool")] [JsonSubtypes.KnownSubType(typeof(LotTool), "LotTool")]
...@@ -47,11 +48,13 @@ public enum GadgetIDs ...@@ -47,11 +48,13 @@ public enum GadgetIDs
Remover = 7, Remover = 7,
EqualCircles = 8, EqualCircles = 8,
MiddlePoint = 9, MiddlePoint = 9,
TestGadget = 10,
} }
public static Dictionary<Type, GadgetIDs> GadgetTypeToIDs = new(){ public static Dictionary<Type, GadgetIDs> GadgetTypeToIDs = new(){
{typeof(UndefinedGadget) , GadgetIDs.Undefined }, {typeof(UndefinedGadget) , GadgetIDs.Undefined },
{typeof(Pointer) , GadgetIDs.Pointer }, {typeof(Pointer) , GadgetIDs.Pointer },
{typeof(TestGadget) , GadgetIDs.TestGadget },
{typeof(Tape) , GadgetIDs.Tape }, {typeof(Tape) , GadgetIDs.Tape },
{typeof(AngleTool) , GadgetIDs.AngleTool }, {typeof(AngleTool) , GadgetIDs.AngleTool },
{typeof(LineTool) , GadgetIDs.LineTool }, {typeof(LineTool) , GadgetIDs.LineTool },
......
using UnityEngine;
public class TestGadget : Gadget
{
/// \copydoc Gadget.s_type
[Newtonsoft.Json.JsonProperty]
protected static new string s_type = "TestGadget";
protected override void _Hit(RaycastHit[] hit)
{
string pid = FactAdder.AddPointFact(hit[0], gadget: this).Id;
for (int i = 0; i < hit.Length; i++)
{
if (!Mathf.Approximately(hit[0].distance, hit[i].distance))
break;
if (hit[i].transform.gameObject.layer == LayerMask.NameToLayer("Ray"))
{
Workflow.Add(hit[i].transform.GetComponent<FactObject>().URI);
FactAdder.AddOnLineFact
(pid
, Workflow[i]
, samestep: true
, gadget: this
, is_certain: false);
}
}
ResetGadget();
}
}
fileFormatVersion: 2
guid: 201a7ead1e39b2d4e832db9738fb7c19
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment