diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scripts/Roads/Node/PermanentNode.cs b/Assets/Scripts/Roads/Node/PermanentNode.cs index 968ec97..af76611 100644 --- a/Assets/Scripts/Roads/Node/PermanentNode.cs +++ b/Assets/Scripts/Roads/Node/PermanentNode.cs @@ -8,4 +8,7 @@ override public void delete() { } + + override public void pull(Vector3 position) { + } } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scripts/Roads/Node/PermanentNode.cs b/Assets/Scripts/Roads/Node/PermanentNode.cs index 968ec97..af76611 100644 --- a/Assets/Scripts/Roads/Node/PermanentNode.cs +++ b/Assets/Scripts/Roads/Node/PermanentNode.cs @@ -8,4 +8,7 @@ override public void delete() { } + + override public void pull(Vector3 position) { + } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs b/Assets/Scripts/Roads/Node/SpawnNode.cs index 8fd4a14..e378f3b 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class SpawnNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class SpawnNode : PermanentNode { + public SpawnNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scripts/Roads/Node/PermanentNode.cs b/Assets/Scripts/Roads/Node/PermanentNode.cs index 968ec97..af76611 100644 --- a/Assets/Scripts/Roads/Node/PermanentNode.cs +++ b/Assets/Scripts/Roads/Node/PermanentNode.cs @@ -8,4 +8,7 @@ override public void delete() { } + + override public void pull(Vector3 position) { + } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs b/Assets/Scripts/Roads/Node/SpawnNode.cs index 8fd4a14..e378f3b 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class SpawnNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class SpawnNode : PermanentNode { + public SpawnNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta index 751f503..7b575de 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 71fd0b84cdaf65f48998acd1412e970e +guid: e433b98efb89dd343b0ee271ca51a318 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scripts/Roads/Node/PermanentNode.cs b/Assets/Scripts/Roads/Node/PermanentNode.cs index 968ec97..af76611 100644 --- a/Assets/Scripts/Roads/Node/PermanentNode.cs +++ b/Assets/Scripts/Roads/Node/PermanentNode.cs @@ -8,4 +8,7 @@ override public void delete() { } + + override public void pull(Vector3 position) { + } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs b/Assets/Scripts/Roads/Node/SpawnNode.cs index 8fd4a14..e378f3b 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class SpawnNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class SpawnNode : PermanentNode { + public SpawnNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta index 751f503..7b575de 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 71fd0b84cdaf65f48998acd1412e970e +guid: e433b98efb89dd343b0ee271ca51a318 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/SpawnNodeData.cs b/Assets/Scripts/Roads/Node/SpawnNodeData.cs new file mode 100644 index 0000000..519c784 --- /dev/null +++ b/Assets/Scripts/Roads/Node/SpawnNodeData.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SpawnNodeData : MonoBehaviour +{ + private SpawnNode node; + public Config config; + + void Start() { + node = new SpawnNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scripts/Roads/Node/PermanentNode.cs b/Assets/Scripts/Roads/Node/PermanentNode.cs index 968ec97..af76611 100644 --- a/Assets/Scripts/Roads/Node/PermanentNode.cs +++ b/Assets/Scripts/Roads/Node/PermanentNode.cs @@ -8,4 +8,7 @@ override public void delete() { } + + override public void pull(Vector3 position) { + } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs b/Assets/Scripts/Roads/Node/SpawnNode.cs index 8fd4a14..e378f3b 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class SpawnNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class SpawnNode : PermanentNode { + public SpawnNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta index 751f503..7b575de 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 71fd0b84cdaf65f48998acd1412e970e +guid: e433b98efb89dd343b0ee271ca51a318 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/SpawnNodeData.cs b/Assets/Scripts/Roads/Node/SpawnNodeData.cs new file mode 100644 index 0000000..519c784 --- /dev/null +++ b/Assets/Scripts/Roads/Node/SpawnNodeData.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SpawnNodeData : MonoBehaviour +{ + private SpawnNode node; + public Config config; + + void Start() { + node = new SpawnNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/SpawnNodeData.cs.meta b/Assets/Scripts/Roads/Node/SpawnNodeData.cs.meta new file mode 100644 index 0000000..751f503 --- /dev/null +++ b/Assets/Scripts/Roads/Node/SpawnNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71fd0b84cdaf65f48998acd1412e970e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0d5ada0..fb22858 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -345,7 +345,7 @@ m_GameObject: {fileID: 267250012} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 0.05, y: 0.05, z: 1000} + m_LocalScale: {x: 0.1, y: 0.05, z: 1000} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 2 @@ -399,6 +399,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267250012} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &349804698 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 349804699} + - component: {fileID: 349804700} + m_Layer: 0 + m_Name: testExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &349804699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &349804700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 349804698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &581008541 GameObject: m_ObjectHideFlags: 0 @@ -433,6 +477,40 @@ m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &616330206 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 616330207} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &616330207 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616330206} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2127136780} + - {fileID: 349804699} + - {fileID: 1380320608} + - {fileID: 1551909213} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -1107,7 +1185,7 @@ m_GameObject: {fileID: 1331646751} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.0251, z: 0} - m_LocalScale: {x: 1000, y: 0.05, z: 0.05} + m_LocalScale: {x: 1000, y: 0.05, z: 0.1} m_Children: [] m_Father: {fileID: 581008542} m_RootOrder: 3 @@ -1161,6 +1239,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331646751} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1380320607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380320608} + - component: {fileID: 1380320609} + m_Layer: 0 + m_Name: testSpawn (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380320608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380320609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380320607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1409854102 GameObject: m_ObjectHideFlags: 0 @@ -1242,6 +1364,50 @@ m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1409854102} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1551909212 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1551909213} + - component: {fileID: 1551909214} + m_Layer: 0 + m_Name: testExit (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1551909213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1551909214 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1551909212} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42b9d9ab3d3a7f54390b6f12f991b39d, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} --- !u!1 &1621584771 GameObject: m_ObjectHideFlags: 0 @@ -1436,3 +1602,48 @@ mainCamera: {fileID: 963194227} material: {fileID: 2100000, guid: e2c5b6e79b6cdb545863f245ced42125, type: 2} config: {fileID: 128843415} + drawMode: 0 +--- !u!1 &2127136779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2127136780} + - component: {fileID: 2127136781} + m_Layer: 0 + m_Name: testSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2127136780 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -10, y: 0, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 616330207} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2127136781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2127136779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71fd0b84cdaf65f48998acd1412e970e, type: 3} + m_Name: + m_EditorClassIdentifier: + config: {fileID: 128843415} diff --git a/Assets/Scripts/Roads/Node/CustomNode.cs b/Assets/Scripts/Roads/Node/CustomNode.cs index 8abdf35..17dd703 100644 --- a/Assets/Scripts/Roads/Node/CustomNode.cs +++ b/Assets/Scripts/Roads/Node/CustomNode.cs @@ -13,4 +13,12 @@ } GameObject.Destroy(gameObject); } + + override public void pull(Vector3 position) { + this.position = position; + gameObject.transform.position = position; + foreach (Road road in roads) { + road.update(true); + } + } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs b/Assets/Scripts/Roads/Node/ExitNode.cs index 033d3a1..71109ab 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs +++ b/Assets/Scripts/Roads/Node/ExitNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class ExitNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class ExitNode : PermanentNode { + public ExitNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/ExitNode.cs.meta b/Assets/Scripts/Roads/Node/ExitNode.cs.meta index 5632cc4..0f2ce8f 100644 --- a/Assets/Scripts/Roads/Node/ExitNode.cs.meta +++ b/Assets/Scripts/Roads/Node/ExitNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42b9d9ab3d3a7f54390b6f12f991b39d +guid: 7a0feb1b36a5aeb41a974d8fc80fc2e2 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs b/Assets/Scripts/Roads/Node/ExitNodeData.cs new file mode 100644 index 0000000..cc59aec --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ExitNodeData: MonoBehaviour { + private ExitNode node; + public Config config; + + void Start() { + node = new ExitNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta new file mode 100644 index 0000000..5632cc4 --- /dev/null +++ b/Assets/Scripts/Roads/Node/ExitNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42b9d9ab3d3a7f54390b6f12f991b39d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Node/Node.cs b/Assets/Scripts/Roads/Node/Node.cs index 0f254ec..e5fbd48 100644 --- a/Assets/Scripts/Roads/Node/Node.cs +++ b/Assets/Scripts/Roads/Node/Node.cs @@ -14,7 +14,7 @@ gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.parent = parent; - gameObject.AddComponent().radius = 2f; + gameObject.AddComponent().radius = 1f; gameObject.layer = 7; gameObject.AddComponent().node = this; @@ -58,13 +58,7 @@ return ((Node)other).position.Equals(position); } - public void pull(Vector3 position) { - this.position = position; - gameObject.transform.position = position; - foreach (Road road in roads) { - road.update(true); - } - } + abstract public void pull(Vector3 position); public void lateUpdate(Road caller) { foreach (Road road in roads) { diff --git a/Assets/Scripts/Roads/Node/PermanentNode.cs b/Assets/Scripts/Roads/Node/PermanentNode.cs index 968ec97..af76611 100644 --- a/Assets/Scripts/Roads/Node/PermanentNode.cs +++ b/Assets/Scripts/Roads/Node/PermanentNode.cs @@ -8,4 +8,7 @@ override public void delete() { } + + override public void pull(Vector3 position) { + } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs b/Assets/Scripts/Roads/Node/SpawnNode.cs index 8fd4a14..e378f3b 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs @@ -2,17 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class SpawnNode : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - +public class SpawnNode : PermanentNode { + public SpawnNode(Vector3 position, Transform parent, Config config): base(position, parent, config) { } } diff --git a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta index 751f503..7b575de 100644 --- a/Assets/Scripts/Roads/Node/SpawnNode.cs.meta +++ b/Assets/Scripts/Roads/Node/SpawnNode.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 71fd0b84cdaf65f48998acd1412e970e +guid: e433b98efb89dd343b0ee271ca51a318 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Roads/Node/SpawnNodeData.cs b/Assets/Scripts/Roads/Node/SpawnNodeData.cs new file mode 100644 index 0000000..519c784 --- /dev/null +++ b/Assets/Scripts/Roads/Node/SpawnNodeData.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SpawnNodeData : MonoBehaviour +{ + private SpawnNode node; + public Config config; + + void Start() { + node = new SpawnNode(transform.position, transform, config); + } + + void Update() { + } +} diff --git a/Assets/Scripts/Roads/Node/SpawnNodeData.cs.meta b/Assets/Scripts/Roads/Node/SpawnNodeData.cs.meta new file mode 100644 index 0000000..751f503 --- /dev/null +++ b/Assets/Scripts/Roads/Node/SpawnNodeData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71fd0b84cdaf65f48998acd1412e970e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Roads/Roads.cs b/Assets/Scripts/Roads/Roads.cs index d9d4f28..6e53a72 100644 --- a/Assets/Scripts/Roads/Roads.cs +++ b/Assets/Scripts/Roads/Roads.cs @@ -71,11 +71,24 @@ } } + public Vector3 snapGroundPosition(Vector3 position, float snapStrength, int interval) { + float x = position.x, z = position.z; + float xRounded = Mathf.Round(x / interval) * interval; + float zRounded = Mathf.Round(z / interval) * interval; + if (Mathf.Abs(x - xRounded) < snapStrength) { + x = xRounded; + } + if (Mathf.Abs(z - zRounded) < snapStrength) { + z = zRounded; + } + return new Vector3(x, 0.0f, z); + } + void Update() { Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 6); - Vector3 groundPosition = new Vector3(hit.point.x, 0.0f, hit.point.z); + Vector3 groundPosition = snapGroundPosition(hit.point, 1f, 5); if (config.mode == Mode.DrawRoad) { handleRoadDrawing(ray, groundPosition);