Skip to content
Snippets Groups Projects
Commit 264e7337 authored by Paul-Walcher's avatar Paul-Walcher
Browse files

SphereGadget

parent c0024627
No related branches found
No related tags found
No related merge requests found
......@@ -27,8 +27,8 @@ MonoBehaviour:
- {fileID: 21300000, guid: d456617ba2282854d9570dcebcc2b279, type: 3}
- {fileID: 21300000, guid: e35797aede3d7bd449ca9195a409b0cc, type: 3}
- {fileID: 21300000, guid: 9831128faf2531e4cba52f58894091be, type: 3}
- {fileID: 21300000, guid: e706f1d2fb068e342b1c80c357d84b40, type: 3}
GadgetType: ffffffff00000000010000000200000003000000040000000500000006000000070000000800000009000000
- {fileID: 21300000, guid: 13f4e064448182b49ba38b5035a1f45a, type: 3}
GadgetType: ffffffff000000000100000002000000030000000400000005000000060000000700000008000000090000000a000000
GadgetData:
- {fileID: 11400000, guid: 7431ff31b707d2a4082b65b61e15e5df, type: 2}
- {fileID: 11400000, guid: c149a1e468d3b3b48a0732c2e0811856, type: 2}
......@@ -41,3 +41,4 @@ MonoBehaviour:
- {fileID: 11400000, guid: 06736b134e21b50488990025c33c9c2e, type: 2}
- {fileID: 11400000, guid: 6bc4e283502549d428d3c9ce74e91757, type: 2}
- {fileID: 11400000, guid: 35d3197399dc8374280464a237271ac5, type: 2}
- {fileID: 11400000, guid: 23a852b1469eeba4ebacccac54ec0f59, 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: SphereGadgetData
m_EditorClassIdentifier: Assembly-CSharp::DataContainerGadgetInit
Rank: 11
MaxRange: 10
MaxHeight: 10
UiName: Sphere Gadget
MaterialIndx: 0
ButtonIndx: 11
LayerHitMask:
serializedVersion: 2
m_Bits: 1637393
SecondaryLayerMask:
serializedVersion: 2
m_Bits: 0
fileFormatVersion: 2
guid: 23a852b1469eeba4ebacccac54ec0f59
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -54,6 +54,12 @@ public static PointFact AddPointFact(Vector3 point, Vector3 normal, bool sameste
, out _, samestep, gadget, scroll_label);
}
public static SphereFact AddSphereFact(string pid1, string pid2, bool samestep = false, Gadget gadget = null, string scroll_label = null){
return (SphereFact)AddFactIfNotFound(
new SphereFact(pid1, pid2), out _, samestep, gadget, scroll_label);
}
/// \copybrief FactManager <summary></summary>
/// <param name="pid"><see cref="Fact.Id"/> of <see cref="PointFact"/> which lies on <paramref name="lid"/></param>
/// <param name="lid"><see cref="Fact.Id"/> of <see cref="LineFact"/> on which <paramref name="pid"/> lies</param>
......
......@@ -20,6 +20,7 @@
[JsonSubtypes.KnownSubType(typeof(PoleTool), "PoleTool")]
[JsonSubtypes.KnownSubType(typeof(Remover), "Remover")]
[JsonSubtypes.KnownSubType(typeof(EqualCircleGadget), "EqualCircles")]
[JsonSubtypes.KnownSubType(typeof(SphereGadget), "SphereGadget")]
[JsonSubtypes.FallBackSubType(typeof(UndefinedGadget))]
public abstract class Gadget
{
......@@ -47,6 +48,7 @@ public enum GadgetIDs
Remover = 7,
EqualCircles = 8,
MiddlePoint = 9,
SphereGadget = 10,
}
......@@ -62,6 +64,7 @@ public enum GadgetIDs
{typeof(Remover) , GadgetIDs.Remover },
{typeof(EqualCircleGadget) , GadgetIDs.EqualCircles },
{typeof(TestMiddlePoint) , GadgetIDs.MiddlePoint },
{typeof(SphereGadget) , GadgetIDs.SphereGadget},
};
/// <summary> Position in tool belt. </summary>
......
using Newtonsoft.Json;
using UnityEngine;
public class SphereGadget : Gadget
{
/// \copydoc Gadget.s_type
[JsonProperty]
protected static new string s_type = "SphereTool";
//Cache for collecting the line
private readonly Vector3[] LineOrigin = new Vector3[1];
protected override void _Hit(RaycastHit[] hit)
{
string tempFactId = hit[0].transform.GetComponent<FactObject>().URI;
if (!Workflow.Contains(tempFactId))
Workflow.Add(tempFactId);
switch (Workflow.Count)
{
case 1:
LineOrigin[0] = hit[0].transform.position;
break;
case 2:
FactAdder.AddSphereFact(Workflow[0], Workflow[1], gadget: this);
ResetGadget();
return;
}
}
}
fileFormatVersion: 2
guid: b82608d3a00b8fd49bb3cf9f24d9dc28
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