Skip to content

Commit

Permalink
#5 fix dog opening door
Browse files Browse the repository at this point in the history
  • Loading branch information
hani-sayegh committed Mar 22, 2017
1 parent 999bdcc commit d5a8f50
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 60 deletions.
7 changes: 7 additions & 0 deletions Assets/Scripts/Camera/Overseer/OverseerTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ private void Awake()
}
}

private void Start()
{
if (!startTarget)
Debug.Log("Your scene needs an starting target for the Overseer to work OK");

}

}
11 changes: 8 additions & 3 deletions Assets/Scripts/Controls/OverSeer/OverseerControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

public class OverseerControls : MonoBehaviour
{
public static OverseerControls Instance;
private void Awake()
{
Instance = this;
}
public string actionButtonX;
public string actionButtonA;
public string actionButtonB;
Expand All @@ -16,7 +21,7 @@ public class OverseerControls : MonoBehaviour

private TimeManager m_TimeManager;

private void Start()
private void Start()
{
m_TimeManager = GameObject.FindGameObjectWithTag("Time Manager").GetComponent<TimeManager>();
}
Expand All @@ -31,14 +36,14 @@ void Update()
{
triggerList(controllablesA);
#if NETWORKING
NetMessenger.Instance.CmdOpenDoor("Green");
NetMessenger.Instance.CmdOpenDoor("Green");
#endif
}
if (Input.GetButtonDown(actionButtonX))
{
triggerList(controllablesX);
#if NETWORKING
NetMessenger.Instance.CmdOpenDoor("Blue");
NetMessenger.Instance.CmdOpenDoor("Blue");
#endif
}
if (Input.GetButtonDown(actionButtonB))
Expand Down
18 changes: 10 additions & 8 deletions Assets/Scripts/Networking/NetMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class NetMessenger : NetworkBehaviour

private void Awake()
{
o = OverseerControls.Instance;
//o = GameObject.FindGameObjectWithTag("Overseer").GetComponent<OverseerControls>();
//Functions in this class MUST be invoked by the client and only the client
//we are getting lucky here because the network manager is spawning
//clientsHost and then client so this ends up being the client
Expand Down Expand Up @@ -42,19 +44,19 @@ public void CmdOpenDoor(string color)
{
if (color == "Green")
{
if (o == null)
{
o = GameObject.FindObjectOfType<OverseerControls>();
}
//if (o == null)
//{
// o = GameObject.FindObjectOfType<OverseerControls>();
//}
o.triggerList(o.controllablesA);
}
else if (color == "Blue")
{
//BlueDoor.GetComponent<Animator>().SetTrigger("toggleObject");
if (o == null)
{
o = GameObject.FindObjectOfType<OverseerControls>();
}
//if (o == null)
//{
// o = GameObject.FindObjectOfType<OverseerControls>();
//}
o.triggerList(o.controllablesX);
}
}
Expand Down
5 changes: 2 additions & 3 deletions Assets/Scripts/Networking/NetworkingCharacterAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ protected virtual void Start()
}
if (host)
{
GetComponent<NetMessenger>().o = GameObject.FindGameObjectWithTag("Overseer").GetComponent<OverseerControls>();
BothHostAndClientsHost();

GameObject overseer = GameObject.FindGameObjectWithTag("Overseer");
Expand All @@ -58,8 +57,8 @@ protected virtual void Start()
//for some reason 0 changes display to 1
lucky.GetComponent<Camera>().targetDisplay = 0;

//if (overseer != null)
// GameObject.FindGameObjectWithTag("Overseer").SetActive(false);
if (overseer != null)
GameObject.FindGameObjectWithTag("Overseer").SetActive(false);

gameObject.name = "host";
}
Expand Down
92 changes: 46 additions & 46 deletions Assets/hanisstuff/Playtest 8.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@ Prefab:
type: 2}
propertyPath: m_TargetTexture
value:
objectReference: {fileID: 493918472}
objectReference: {fileID: 719767403}
- target: {fileID: 95535478316193998, guid: 0537e9a616f190341a12297467c884f9,
type: 2}
propertyPath: m_Enabled
Expand Down Expand Up @@ -3118,28 +3118,6 @@ GameObject:
m_PrefabParentObject: {fileID: 1649229833953150, guid: 868df6ca073273b46b0d14bf91e88925,
type: 2}
m_PrefabInternal: {fileID: 1428195643}
--- !u!84 &493918472
RenderTexture:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_Width: 664
m_Height: 688
m_AntiAliasing: 2
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_TextureSettings:
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapMode: 1
--- !u!1 &498487761
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3683,28 +3661,6 @@ Transform:
m_Father: {fileID: 1861190822}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!84 &628582098
RenderTexture:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_Width: 664
m_Height: 688
m_AntiAliasing: 2
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_TextureSettings:
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapMode: 1
--- !u!1 &629278006
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4310,6 +4266,28 @@ MeshFilter:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 717686804}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!84 &719767403
RenderTexture:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_Width: 503
m_Height: 688
m_AntiAliasing: 2
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_TextureSettings:
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapMode: 1
--- !u!1 &719953071
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -7850,6 +7828,28 @@ MeshFilter:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1525453800}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!84 &1526370392
RenderTexture:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_Width: 503
m_Height: 688
m_AntiAliasing: 2
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_TextureSettings:
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapMode: 1
--- !u!1 &1527006237
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -9697,7 +9697,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
pivot: {fileID: 600567086}
startingTarget: 0
startingTarget: 1
positionOffset: {x: -6.610001, y: 25.79, z: -27.7}
--- !u!1 &1750368987
GameObject:
Expand Down

0 comments on commit d5a8f50

Please sign in to comment.