- Added the friendship links (randomly generated for now)

This commit is contained in:
Patrice Vignola 2015-08-12 11:45:51 -04:00
parent 50534f968f
commit d53ad69802
7 changed files with 87 additions and 449 deletions

View File

@ -145,8 +145,8 @@ Camera:
height: 1 height: 1
near clip plane: .300000012 near clip plane: .300000012
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 49
orthographic: 1 orthographic: 0
orthographic size: 5 orthographic size: 5
m_Depth: -1 m_Depth: -1
m_CullingMask: m_CullingMask:
@ -165,141 +165,12 @@ Transform:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 61719360} m_GameObject: {fileID: 61719360}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -.259112954, y: .110958092, z: -.0299803261, w: -.958983839}
m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalPosition: {x: 2.95000005, y: 9.18000031, z: -15.3199997}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 0
--- !u!1001 &110979653
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalPosition.x
value: -4.78000021
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalPosition.y
value: 2.84048653
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalRotation.x
value: .70710659
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_LocalRotation.w
value: -.707106948
objectReference: {fileID: 0}
- target: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
m_IsPrefabParent: 0
--- !u!4 &312333934 stripped
Transform:
m_PrefabParentObject: {fileID: 456258, guid: c5b66487a8909dc42a46e73c0b340df0, type: 2}
m_PrefabInternal: {fileID: 110979653}
--- !u!120 &326773241 stripped
LineRenderer:
m_PrefabParentObject: {fileID: 12095142, guid: fab430cecad80ad4391987a06b550cb7,
type: 2}
m_PrefabInternal: {fileID: 1631297195}
--- !u!1001 &397033313
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalPosition.x
value: -.573046267
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalPosition.y
value: -.809006572
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: StartPoint
value:
objectReference: {fileID: 1070389998}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: EndPoint
value:
objectReference: {fileID: 1040435545}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: BeamLine
value:
objectReference: {fileID: 1979266189}
- target: {fileID: 195136, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 195134, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: StartObject
value:
objectReference: {fileID: 312333934}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: EndObject
value:
objectReference: {fileID: 1398388657}
- target: {fileID: 12095142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 40733a86ddd05214d99d64b3771e45b6, type: 2}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
m_IsPrefabParent: 0
--- !u!4 &734198074 stripped
Transform:
m_PrefabParentObject: {fileID: 495134, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
m_PrefabInternal: {fileID: 1631297195}
--- !u!1 &736567784 --- !u!1 &736567784
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -373,7 +244,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 2
--- !u!114 &736567789 --- !u!114 &736567789
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -385,17 +256,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d0907c1567bad554c8b995de3459e517, type: 3} m_Script: {fileID: 11500000, guid: d0907c1567bad554c8b995de3459e517, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Link: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
SpherePrototype: {fileID: 140654, guid: 646dd6566f9e1374caa3af8ad37c43d3, type: 2} SpherePrototype: {fileID: 140654, guid: 646dd6566f9e1374caa3af8ad37c43d3, type: 2}
PointsAmount: 1000 PointsAmount: 400
SphereRadius: 5 SphereRadius: 7
--- !u!4 &1040435545 stripped
Transform:
m_PrefabParentObject: {fileID: 495134, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
m_PrefabInternal: {fileID: 397033313}
--- !u!4 &1070389998 stripped
Transform:
m_PrefabParentObject: {fileID: 495136, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
m_PrefabInternal: {fileID: 397033313}
--- !u!1 &1126063559 --- !u!1 &1126063559
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -411,7 +275,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!108 &1126063560 --- !u!108 &1126063560
Light: Light:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -455,237 +319,4 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 1
--- !u!1 &1398388656
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1398388657}
- 33: {fileID: 1398388660}
- 64: {fileID: 1398388659}
- 23: {fileID: 1398388658}
m_Layer: 0
m_Name: Person2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1398388657
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1398388656}
m_LocalRotation: {x: .70710659, y: 0, z: 0, w: -.707106948}
m_LocalPosition: {x: .200000003, y: 3.32999992, z: 0}
m_LocalScale: {x: .100000001, y: .100000001, z: .100000001}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
--- !u!23 &1398388658
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1398388656}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!64 &1398388659
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1398388656}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 0
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &1398388660
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1398388656}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1439566042
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1439566043}
- 33: {fileID: 1439566046}
- 64: {fileID: 1439566045}
- 23: {fileID: 1439566044}
m_Layer: 0
m_Name: Person3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1439566043
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1439566042}
m_LocalRotation: {x: .70710659, y: 0, z: 0, w: -.707106948}
m_LocalPosition: {x: 5.21999979, y: 2.51999998, z: 0}
m_LocalScale: {x: .100000001, y: .100000001, z: .100000001}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
--- !u!23 &1439566044
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1439566042}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!64 &1439566045
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1439566042}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 0
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &1439566046
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1439566042}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &1631297195
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalPosition.x
value: -.573046267
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalPosition.y
value: -.809006572
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: StartPoint
value:
objectReference: {fileID: 1777942510}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: EndPoint
value:
objectReference: {fileID: 734198074}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: BeamLine
value:
objectReference: {fileID: 326773241}
- target: {fileID: 195136, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 195134, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: StartObject
value:
objectReference: {fileID: 1398388657}
- target: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: EndObject
value:
objectReference: {fileID: 1439566043}
- target: {fileID: 12095142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 40733a86ddd05214d99d64b3771e45b6, type: 2}
- target: {fileID: 195142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
propertyPath: m_Name
value: AspiBeam 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
m_IsPrefabParent: 0
--- !u!4 &1777942510 stripped
Transform:
m_PrefabParentObject: {fileID: 495136, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
m_PrefabInternal: {fileID: 1631297195}
--- !u!120 &1979266189 stripped
LineRenderer:
m_PrefabParentObject: {fileID: 12095142, guid: fab430cecad80ad4391987a06b550cb7,
type: 2}
m_PrefabInternal: {fileID: 397033313}

View File

@ -1,21 +1,34 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
public class Beam : MonoBehaviour public class FriendshipLink : MonoBehaviour
{ {
public Transform StartPoint; [SerializeField]
public Transform EndPoint; private Transform StartPoint;
public LineRenderer BeamLine;
[SerializeField]
private Transform EndPoint;
[SerializeField]
private LineRenderer BeamLine;
//public ParticleSystem BeamParticles; //public ParticleSystem BeamParticles;
public Transform StartObject; [SerializeField]
public Transform EndObject; private Transform StartObject;
[SerializeField]
private Transform EndObject;
private float LIFETIME_RATIO = 0.025f; private float LIFETIME_RATIO = 0.025f;
void Awake() void Awake()
{ {
BeamLine.SetWidth(0.2f, 0.2f); BeamLine.SetWidth(0.2f, 0.2f);
Renderer lineRenderer = BeamLine.GetComponent<Renderer>();
lineRenderer.material = Instantiate(lineRenderer.material);
//Activate(false); //Activate(false);
} }
@ -34,8 +47,8 @@ public class Beam : MonoBehaviour
private void UpdateVisualEffects() private void UpdateVisualEffects()
{ {
StartPoint.position = StartObject.position + new Vector3(0f, 0f, 0.5f); StartPoint.position = StartObject.position + new Vector3(0f, 0f, 0f);
EndPoint.position = EndObject.position + new Vector3(0f, 0f, 0.5f); EndPoint.position = EndObject.position + new Vector3(0f, 0f, 0f);
float angle = Vector3.Angle(EndPoint.position - StartPoint.position, transform.right); float angle = Vector3.Angle(EndPoint.position - StartPoint.position, transform.right);
@ -50,4 +63,10 @@ public class Beam : MonoBehaviour
BeamLine.SetPosition(0, StartPoint.position); BeamLine.SetPosition(0, StartPoint.position);
BeamLine.SetPosition(1, EndPoint.position); BeamLine.SetPosition(1, EndPoint.position);
} }
public void AttachToObjects(GameObject origin, GameObject destination)
{
StartObject = origin.transform;
EndObject = destination.transform;
}
} }

View File

@ -73,7 +73,7 @@ GameObject:
- 4: {fileID: 495142} - 4: {fileID: 495142}
- 114: {fileID: 11495142} - 114: {fileID: 11495142}
m_Layer: 0 m_Layer: 0
m_Name: AspiBeam m_Name: FriendshipLink
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -135,7 +135,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 195142} m_GameObject: {fileID: 195142}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -3.6500001, z: 0} m_LocalPosition: {x: -.573046267, y: -.809006572, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 495136} - {fileID: 495136}
@ -154,9 +154,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c495d00d780bd3d49866ec60f5efbf66, type: 3} m_Script: {fileID: 11500000, guid: c495d00d780bd3d49866ec60f5efbf66, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
StartPoint: {fileID: 0} StartPoint: {fileID: 495136}
EndPoint: {fileID: 0} EndPoint: {fileID: 495134}
BeamLine: {fileID: 0} BeamLine: {fileID: 12095142}
StartObject: {fileID: 0} StartObject: {fileID: 0}
EndObject: {fileID: 0} EndObject: {fileID: 0}
--- !u!120 &12095142 --- !u!120 &12095142
@ -169,7 +169,7 @@ LineRenderer:
m_CastShadows: 1 m_CastShadows: 1
m_ReceiveShadows: 1 m_ReceiveShadows: 1
m_Materials: m_Materials:
- {fileID: 2100000, guid: 6e2fd46a10c2e3d4eaf42976ce304c87, type: 2} - {fileID: 2100000, guid: 40733a86ddd05214d99d64b3771e45b6, type: 2}
m_SubsetIndices: m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0} m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0 m_UseLightProbes: 0

View File

@ -19,7 +19,7 @@ Material:
name: _MainTex name: _MainTex
second: second:
m_Texture: {fileID: 2800000, guid: dce27f2c9adab1144824c9b2040f18d5, type: 3} m_Texture: {fileID: 2800000, guid: dce27f2c9adab1144824c9b2040f18d5, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 24.6399994, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
data: data:
first: first:
@ -150,4 +150,4 @@ Material:
data: data:
first: first:
name: _TintColor name: _TintColor
second: {r: .5, g: .5, b: .5, a: .5} second: {r: .257352948, g: .10029196, b: .233522967, a: .501960814}

View File

@ -3,74 +3,62 @@ using System.Collections;
public class Sphere : MonoBehaviour public class Sphere : MonoBehaviour
{ {
public FriendshipLink Link;
public GameObject SpherePrototype; public GameObject SpherePrototype;
public int PointsAmount = 50; public int PointsAmount = 50;
public float SphereRadius = 1f; public float SphereRadius = 1f;
private GameObject[] nodes;
void Awake() void Awake()
{ {
// First test (Orion Elenzil) InstantiateNodes();
/* AssignLinks();
for (int i = 0; i < PointsAmount; i++) }
{
float theta = (360f / PointsAmount) * i;
float phi = (Mathf.PI / 2 / PointsAmount) * i;
float x = Mathf.Cos(Mathf.Sqrt(phi)) * Mathf.Cos(theta); private void InstantiateNodes()
float y = Mathf.Cos(Mathf.Sqrt(phi)) * Mathf.Sin(theta); {
float z = (UnityEngine.Random.value < 0.5f ? -1 : 1) * Mathf.Sin(Mathf.Sqrt(phi)); /* Sphere uniform distribution using the spiral method with the golden angle
Debug.Log(UnityEngine.Random.value); * ~2.39996323 rad, the golden angle (the most irrational angle)
Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity); * is used here to make sure that the sin and cos functions
}*/ * dont end up drawing clusters of points and the spirals are way
* less visible.
*/
nodes = new GameObject[PointsAmount];
// Second test (default unit sphere random distribution) float goldenAngle = Mathf.PI * (3 - Mathf.Sqrt(5));
/*
for (int i = 0; i < PointsAmount; i++)
{
float u = UnityEngine.Random.Range(-1f, 1f);
float a = UnityEngine.Random.Range(0f, 2 * Mathf.PI);
float x = Mathf.Sqrt(1 - u * u) * Mathf.Cos(a); float zDistance = (2f / PointsAmount) * SphereRadius;
float y = Mathf.Sqrt(1 - u * u) * Mathf.Sin(a);
float z = u;
Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity);
}*/
// Third test (sphere semi-uniform distribution)
/*
for (int i = 0; i < PointsAmount; i++)
{
float u = (SphereRadius * 2 / PointsAmount) * i - SphereRadius;
float a = UnityEngine.Random.Range(0f, 2 * Mathf.PI); // ((2 * Mathf.PI) / PointsAmount) * i;
Debug.Log(a);
float x = Mathf.Sqrt(SphereRadius * SphereRadius - u * u) * Mathf.Cos(a);
float y = Mathf.Sqrt(SphereRadius * SphereRadius - u * u) * Mathf.Sin(a);
float z = u;
Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity);
}*/
// Fourth test (sphere uniform distribution using the spiral method)
float dlong = Mathf.PI * (3 - Mathf.Sqrt(5)); //~2.39996323
float dz = (2f/PointsAmount) * SphereRadius;
float longitude = 0f; float longitude = 0f;
float z = SphereRadius - dz/2; float z = SphereRadius;
for (int i = 0; i < PointsAmount; i++) for (int i = 0; i < PointsAmount; i++)
{ {
float r = Mathf.Sqrt(SphereRadius * SphereRadius - z * z); float r = Mathf.Sqrt(SphereRadius * SphereRadius - z * z);
float x = Mathf.Cos(longitude) * r; float x = Mathf.Sin(longitude) * r;
float y = Mathf.Sin(longitude) * r; float y = Mathf.Cos(longitude) * r;
Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity); GameObject simon = Instantiate(SpherePrototype, new Vector3(x, y, z), Quaternion.identity) as GameObject;
z -= dz; simon.transform.parent = this.transform;
longitude += dlong;
} nodes[i] = simon;
z -= zDistance;
longitude += goldenAngle;
}
}
private void AssignLinks()
{
for (int i = 0; i < nodes.Length / 4; i++)
{
FriendshipLink link = Instantiate(Link) as FriendshipLink;
int destinationIndex = Random.Range(nodes.Length / 2, nodes.Length - 1);
link.AttachToObjects(nodes[i], nodes[destinationIndex]);
}
} }
} }