Commit 8d2ecd64 authored by Nicolai Grymer's avatar Nicolai Grymer
Browse files

Final state

parent 25c585c8
......@@ -143,11 +143,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 427caa039001e4244b262685822a2cf2, type: 3}
m_Name:
m_EditorClassIdentifier:
_offsetObject: {fileID: 4184757590700640217}
_plane: {fileID: 518783323911736009}
sharedMaterial: {fileID: 2100000, guid: 0bd6c1e0d6c5840b5aa49a63d4047a42, type: 2}
unsharedMaterial: {fileID: 2100000, guid: 9e552f0329b3f45d5b7456fd1909c155, type: 2}
_crosshair: {fileID: 3156856584310028364, guid: 6728d6e7d3a3c4e2abd88136ae80cd7c,
offsetObject: {fileID: 4184757590700640217}
plane: {fileID: 518783323911736009}
focusMaterial: {fileID: 2100000, guid: 97265a79a1000412d9c196308e1a70e4, type: 2}
unfocusedMaterial: {fileID: 2100000, guid: 9c8b1d40a481f4c85bf65afb1586cd35, type: 2}
crosshair: {fileID: 3156856584310028364, guid: 6728d6e7d3a3c4e2abd88136ae80cd7c,
type: 3}
newBlockObject: {fileID: 3156856584310028364, guid: 3b6c5a4dc861746b58d3c8f8634c90d4,
type: 3}
......@@ -304,7 +304,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &6720049349438678949
Transform:
m_ObjectHideFlags: 0
......@@ -388,7 +388,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &5778595442955063857
Transform:
m_ObjectHideFlags: 0
......@@ -569,7 +569,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &8924709537061310013
Transform:
m_ObjectHideFlags: 0
......@@ -653,7 +653,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &3704019214932849090
Transform:
m_ObjectHideFlags: 0
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4392949313990182723
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1960999072185864293}
m_Layer: 0
m_Name: invisAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1960999072185864293
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4392949313990182723}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
fileFormatVersion: 2
guid: bac374511d0d34539b3b348185d3eb4a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -538,6 +538,7 @@ RectTransform:
m_Children:
- {fileID: 488746400}
- {fileID: 1530439522}
- {fileID: 814933252}
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -733,6 +734,139 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &221201030
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 221201031}
- component: {fileID: 221201034}
- component: {fileID: 221201033}
- component: {fileID: 221201032}
m_Layer: 5
m_Name: ForceStalk
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &221201031
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 221201030}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 897481143}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: -350}
m_SizeDelta: {x: 115, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &221201032
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 221201030}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 221201033}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1679110039}
m_TargetAssemblyTypeName: UI.ClickEventHandler, Assembly-CSharp
m_MethodName: ForceStalk
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
--- !u!114 &221201033
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 221201030}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.7511432, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 6e150f83f6c534ffeb00a2278baaa5c6, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &221201034
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 221201030}
m_CullTransparentMesh: 1
--- !u!1 &225404139
GameObject:
m_ObjectHideFlags: 0
......@@ -767,9 +901,9 @@ RectTransform:
m_Father: {fileID: 897481143}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 100, y: -650}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: -650}
m_SizeDelta: {x: 115, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &225404141
......@@ -1102,13 +1236,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 310786268}
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: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5635419927228444810}
m_RootOrder: 8
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &338606775
GameObject:
......@@ -2221,7 +2355,7 @@ AudioListener:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 703456839}
m_Enabled: 1
m_Enabled: 0
--- !u!20 &703456841
Camera:
m_ObjectHideFlags: 0
......@@ -2912,6 +3046,82 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 784465614}
m_CullTransparentMesh: 1
--- !u!1 &814933251
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 814933252}
- component: {fileID: 814933254}
- component: {fileID: 814933253}
m_Layer: 5
m_Name: Participant Color
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &814933252
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 814933251}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 170097830}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 37}
m_SizeDelta: {x: 2000, y: 75}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &814933253
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 814933251}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 1290eacd009f742ee8b2fd7a38657396, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &814933254
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 814933251}
m_CullTransparentMesh: 1
--- !u!1 &831156121
GameObject:
m_ObjectHideFlags: 0
......@@ -3164,6 +3374,9 @@ MonoBehaviour:
StalkerCanvas: {fileID: 170097826}
SwapButton: {fileID: 1530439521}
NormalCanvas: {fileID: 897481139}
participantFeedbackImages:
- {fileID: 814933253}
- {fileID: 488746402}
--- !u!114 &834168819
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -3583,6 +3796,7 @@ RectTransform:
- {fileID: 338606779}
- {fileID: 975325585}
- {fileID: 225404140}
- {fileID: 221201031}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -4080,9 +4294,9 @@ RectTransform:
m_Father: {fileID: 897481143}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 100, y: -500}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: -500}
m_SizeDelta: {x: 115, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &975325586
......@@ -4485,7 +4699,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.025951147, g: 1, b: 0, a: 0.43137255}
m_Color: {r: 0.02520132, g: 1, b: 0, a: 0.6745098}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
......@@ -5045,7 +5259,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
houseModel: {fileID: 2641341263410574702, guid: 6e9789f83358a429a936514d894f0364,
type: 3}
anchorModel: {fileID: 8182956443887353202, guid: 7ab75e6d1363a42c883343aef7bc3596,
anchorModel: {fileID: 4392949313990182723, guid: bac374511d0d34539b3b348185d3eb4a,
type: 3}
crosshair: {fileID: 6954717443088451165, guid: c7560c717291e4141b0b1e4c8587ba2f,
type: 3}
......@@ -7551,7 +7765,6 @@ Transform:
- {fileID: 6572737231761670636}
- {fileID: 4549685552998594733}
- {fileID: 4456994791740113178}
- {fileID: 310786269}
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......
namespace Communication.ActionPackage
{
public class ForceStalkAction : IAction
{
public int StalkedID;
public ForceStalkAction(int myId)
{
StalkedID = myId;
}
public int GetHouseID()
{
return 0;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 484be94e9f2e4265a361176273a68eba
timeCreated: 1654246403
\ No newline at end of file
......@@ -118,16 +118,23 @@ namespace UnityEngine.XR.ARFoundation.Samples.Communication
case TypeOfPackage.StalkAction:
var stalkAction = ToAction<StalkingAction>(data);
if (stalkAction.IsStalking)
StalkerHandler.GetStalker().AddStalker(stalkAction.StalkerID, stalkAction.StalkedID);
StalkerHandler.Get().AddStalker(stalkAction.StalkerID, stalkAction.StalkedID);
else
StalkerHandler.GetStalker().RemoveStalker(stalkAction.StalkerID, stalkAction.StalkedID);
StalkerHandler.Get().RemoveStalker(stalkAction.StalkerID, stalkAction.StalkedID);
break;
case TypeOfPackage.ForceStalkAction:
var forceStalkAction = ToAction<ForceStalkAction>(data);
StalkerHandler.Get().StartStalking(forceStalkAction.StalkedID);
break;
// Load new world
case TypeOfPackage.LoadWorld:
var loadWorldAction = ToAction<LoadWorldAction>(data);
_houseManager.AddWorldLoadToUnprocessed(loadWorldAction);
break;
// Request world data from other participants
case TypeOfPackage.RequestLoadWorld:
_houseManager.AnswerLoadWorldRequest();
break;
......
......@@ -19,6 +19,7 @@ namespace UnityEngine.XR.ARFoundation.Samples.Communication
CopyHouse,
PlayerIDs,
StalkAction,
ForceStalkAction,
ReplaceAction,
CreateNewGeofence,
LoadWorld,
......
......@@ -31,7 +31,7 @@ namespace UnityEngine.XR.ARFoundation.Samples
private bool _isConstructed = false;
private bool _isConstructing = false;
private Vector3? _position = null;
public Vector3? position { get; private set; } = null;
private Quaternion _rotation;
private Vector2 _scale;
......@@ -64,7 +64,6 @@ namespace UnityEngine.XR.ARFoundation.Samples
meshes.Add(meshRenderer);
foreach (var meshRenderer in fence4.GetComponentsInChildren<MeshRenderer>())
meshes.Add(meshRenderer);
Debug.Log(meshes.Count);
}
public static GeofenceManager Get()
......@@ -157,21 +156,26 @@ namespace UnityEngine.XR.ARFoundation.Samples
[SerializeField] private GameObject scaleObject;
public List<House> SetScale(Vector3 scale)
public void SetScaleRotation(float scale, Vector3 rotate)
{
if (position == null) return;
scaleObject.transform.position = (Vector3) position;
scaleObject.transform.rotation = _rotation;
foreach (var house in _housesInsideGeofence)
{
house.transform.parent = scaleObject.transform;
house.offsetObject.transform.SetParent(scaleObject.transform);
}
scaleObject.transform.localScale = scale;
scaleObject.transform.localScale *= scale;
scaleObject.transform.Rotate(rotate);
if (position != null) BuildFromValues(position.Value, _rotation, _scale * scale);
foreach (var house in _housesInsideGeofence)
{
house.transform.DetachChildren();
house.offsetObject.transform.SetParent(house.gameObject.transform);
}
return _housesInsideGeofence;
}
public void SetScaleFromOthers(List<House> houses, Vector3 position, Vector3 scale)
......@@ -194,28 +198,6 @@ namespace UnityEngine.XR.ARFoundation.Samples
scaleObject.transform.position = originalPosition;
}
public List<House> Rotate(Vector3 rotate)
{
foreach (var house in _housesInsideGeofence)
{
house.transform.parent = scaleObject.transform;
}
scaleObject.transform.Rotate(rotate);
foreach (var house in _housesInsideGeofence)
{
house.transform.DetachChildren();
}
return _housesInsideGeofence;
}
public Vector3 GetScale()
{
return scaleObject.transform.localScale;
}
public struct Geofence
{
public Vector2 A;
......@@ -272,8 +254,8 @@ namespace UnityEngine.XR.ARFoundation.Samples
{
if (!_isConstructing && !_isConstructed || _isConstructing && !pole3.activeSelf) return null;
if (_position != null)
return new SerializableGeofence(_position.Value
if (position != null)
return new SerializableGeofence(position.Value
, _rotation
, _scale
);
......@@ -316,7 +298,7 @@ namespace UnityEngine.XR.ARFoundation.Samples
var p3 = pole3.transform.position;
var p4 = pole4.transform.position;
_position = p1 + (p3 - p1) / 2;
position = p1 + (p3 - p1) / 2;
_rotation = Quaternion.LookRotation(p2 - p1);
var x = Vector3.Distance(p1, p2);
var y = Vector3.Distance(p2, p3);
......@@ -326,7 +308,7 @@ namespace UnityEngine.XR.ARFoundation.Samples
InvokeGeofenceChangeEvent(ConvertTo2D(p1),ConvertTo2D(p2),ConvertTo2D(p3),ConvertTo2D(p4));
// Distribute this
DistributeNewGeofence(_position.Value, _rotation, _scale);
DistributeNewGeofence(position.Value, _rotation, _scale);
}
public void FixGeofenceFromPlacement(bool fixScale = false)
......@@ -348,7 +330,7 @@ namespace UnityEngine.XR.ARFoundation.Samples
pole4.transform.position = p4;
}
_position = p1 + (p3 - p1) / 2;
position = p1 + (p3 - p1) / 2;
_rotation = Quaternion.LookRotation(p2 - p1);
var x = Vector3.Distance(p1, p2);
var y = Vector3.Distance(p2, p3);
......@@ -382,9 +364,9 @@ namespace UnityEngine.XR.ARFoundation.Samples
_isConstructing = false;
_isConstructed = false;
SetActiveAll(false);
if (_position == null) return;