Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharingandshootingmerged #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file modified .vs/SuperHuman/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file removed .vs/SuperHuman/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file removed .vs/SuperHuman/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class CustomMessages : Singleton<CustomMessages>
public enum TestMessageID : byte
{
HeadTransform = MessageID.UserMessageIDStart,
FirstPlayer,
BlueShieldsDestroyed,
RedShieldsDestroyed,
Max
}

Expand Down Expand Up @@ -163,9 +166,73 @@ private void OnMessageReceived(NetworkConnection connection, NetworkInMessage ms
}
}

#region HelperFunctionsForWriting

private void AppendTransform(NetworkOutMessage msg, Vector3 position, Quaternion rotation)
public void SendBlueShieldsDestroyed()
{
Debug.Log("Broadcasting Blue Shields Destroyed");
// If we are connected to a session, broadcast our head info
if (this.serverConnection != null && this.serverConnection.IsConnected())
{
// Create an outgoing network message to contain all the info we want to send
NetworkOutMessage msg = CreateMessage((byte)TestMessageID.BlueShieldsDestroyed);

//AppendTransform(msg, position, rotation);

// Send the message as a broadcast, which will cause the server to forward it to all other users in the session.
this.serverConnection.Broadcast(
msg,
MessagePriority.Immediate,
MessageReliability.ReliableOrdered,
MessageChannel.Avatar);
Debug.Log("**********Broadcasting Blue Shields Destroyed");
}

}

public void SendRedShieldsDestroyed()
{
Debug.Log("Broadcasting Red Shields Destroyed");
// If we are connected to a session, broadcast our head info
if (this.serverConnection != null && this.serverConnection.IsConnected())
{
// Create an outgoing network message to contain all the info we want to send
NetworkOutMessage msg = CreateMessage((byte)TestMessageID.RedShieldsDestroyed);

//AppendTransform(msg, position, rotation);

// Send the message as a broadcast, which will cause the server to forward it to all other users in the session.
this.serverConnection.Broadcast(
msg,
MessagePriority.Immediate,
MessageReliability.ReliableOrdered,
MessageChannel.Avatar);
Debug.Log("**********Broadcasting Red Shields Destroyed");
}
}

public void SendFirstPlayer()
{
Debug.Log("Broadcasting First Player");
// If we are connected to a session, broadcast our head info
if (this.serverConnection != null && this.serverConnection.IsConnected())
{
// Create an outgoing network message to contain all the info we want to send
NetworkOutMessage msg = CreateMessage((byte)TestMessageID.FirstPlayer);

//AppendTransform(msg, position, rotation);

// Send the message as a broadcast, which will cause the server to forward it to all other users in the session.
this.serverConnection.Broadcast(
msg,
MessagePriority.Immediate,
MessageReliability.ReliableOrdered,
MessageChannel.Avatar);
Debug.Log("**********Broadcasting First Player finished scanning.");
}
}

#region HelperFunctionsForWriting

private void AppendTransform(NetworkOutMessage msg, Vector3 position, Quaternion rotation)
{
AppendVector3(msg, position);
AppendQuaternion(msg, rotation);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: BoundingboxTransparantBlue
m_Shader: {fileID: 4800000, guid: 30a212a88e1063a428c85e50b1e427f2, type: 3}
m_ShaderKeywords: _ALPHABLEND_ON _EMISSION _GLOSSYREFLECTIONS_OFF
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 7d87b784830b6b84a803d1ecdeb30f4e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.412
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.07586192, g: 0, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: BoundingboxTransparantRed
m_Shader: {fileID: 4800000, guid: 30a212a88e1063a428c85e50b1e427f2, type: 3}
m_ShaderKeywords: _ALPHABLEND_ON _EMISSION _GLOSSYREFLECTIONS_OFF
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 7d87b784830b6b84a803d1ecdeb30f4e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.412
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public bool Spawn(SyncSpawnedObject dataModel, Vector3 localPosition, Quaternion
/// <returns>True if the function succeeded, false if not.</returns>
public bool Spawn(SyncSpawnedObject dataModel, Vector3 localPosition, Quaternion localRotation, GameObject parent, string baseName, bool isOwnedLocally)
{
//localRotation = Quaternion.Euler(0, 0, 0);
return Spawn(dataModel, localPosition, localRotation, null, parent, baseName, isOwnedLocally);
}

Expand Down
32 changes: 29 additions & 3 deletions Assets/Assets/MappingPlaceholderScript.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using HoloToolkit.Unity;
using HoloToolkit.Sharing;
using HoloToolkit.Sharing.Tests;
using HoloToolkit.Unity;
using System;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -15,21 +17,25 @@ public class MappingPlaceholderScript : MonoBehaviour
public GameObject g;
public GameObject holocamera;
public GameObject lava;
public bool isFpMsgSentOrRcvd;
private SpatialUnderstandingDllTopology.TopologyResult[] resultsTopology = new SpatialUnderstandingDllTopology.TopologyResult[512];


int frameCount;
IntPtr statsPtr;
public static bool scanning = true;


CustomMessages customMessages;
private bool draw = true;


// Use this for initialization
void Start()
{
isFpMsgSentOrRcvd = false;
scanning = true;
customMessages = CustomMessages.Instance;
customMessages.MessageHandlers[CustomMessages.TestMessageID.FirstPlayer] = this.SetPlayerRole;
}

public void ScannedEnough()
Expand All @@ -54,6 +60,13 @@ void Update()
{
this.findPositionsOnFloor();
}
if (!isFpMsgSentOrRcvd)
{
//whoever sends first message after scanning becomes first player.
CustomMessages.Instance.SendFirstPlayer();
isFpMsgSentOrRcvd = true;
TappedHandler.isFirstPlayer = true;
}

}
}
Expand Down Expand Up @@ -118,6 +131,7 @@ public void findPositionsOnFloor()
g.transform.position = new Vector3(holocamera.transform.position.x, rect.position.y + 0.02f, holocamera.transform.position.z);
lava.transform.position = new Vector3(holocamera.transform.position.x, rect.position.y - 1.0f, holocamera.transform.position.z);


//g.transform.
break;

Expand All @@ -129,5 +143,17 @@ public void findPositionsOnFloor()
}
}

public void SetPlayerRole(NetworkInMessage msg)
{
Debug.Log("Setting Player 1 or 2.");
// Parse the message
long userID = msg.ReadInt64();
TappedHandler.isFirstPlayer = false;
TappedHandler.isCorePlaced = true;
//prevent sending the broadcast message.
isFpMsgSentOrRcvd = true;

}


}
10 changes: 10 additions & 0 deletions Assets/Audio.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Assets/Audio/Mixers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading