Skip to content

Commit

Permalink
#5 Timer is done and networked
Browse files Browse the repository at this point in the history
  • Loading branch information
hani-sayegh committed Mar 3, 2017
1 parent b7d802f commit 07a54c3
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 22 deletions.
8 changes: 7 additions & 1 deletion Assets/Prefabs/Test/NetworkTestGroundController.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GameObject:
- component: {fileID: 114207589162456876}
m_Layer: 0
m_Name: NetworkTestGroundController
m_TagString: Untagged
m_TagString: PlayerGround
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand Down Expand Up @@ -340,7 +340,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5dcd5b2ef063e084f9439dab4c8d20ca, type: 3}
m_Name:
m_EditorClassIdentifier:
DisableOnClientsHost: []
clientsHost: 0
hostsClient: 0
client: 0
host: 0
timer: {fileID: 0}
go: 0
--- !u!114 &114280900742100736
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down
182 changes: 175 additions & 7 deletions Assets/Scene/Test Scenes/Networking Test.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,99 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!1 &892924126
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 892924130}
- component: {fileID: 892924129}
- component: {fileID: 892924128}
- component: {fileID: 892924127}
m_Layer: 5
m_Name: Canvas (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!114 &892924127
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 892924126}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &892924128
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 892924126}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &892924129
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 892924126}
m_Enabled: 1
serializedVersion: 2
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &892924130
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 892924126}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 997685750}
m_Father: {fileID: 0}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &899852118
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1411,6 +1504,82 @@ Transform:
m_PrefabParentObject: {fileID: 4089799203499198, guid: 6c81921ea04bfc8478bbee993c344510,
type: 2}
m_PrefabInternal: {fileID: 1581271636}
--- !u!1 &997685749
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 997685750}
- component: {fileID: 997685752}
- component: {fileID: 997685751}
m_Layer: 5
m_Name: Timer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &997685750
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 997685749}
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: []
m_Father: {fileID: 892924130}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 60}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &997685751
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 997685749}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.7352941, g: 0.7352941, b: 0.7352941, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 15
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Waiting for overseer to connect...
'
--- !u!222 &997685752
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 997685749}
--- !u!1 &1063355021
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2238,7 +2407,7 @@ GameObject:
- component: {fileID: 1681601058}
m_Layer: 5
m_Name: Timer
m_TagString: Untagged
m_TagString: Timer
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand All @@ -2259,7 +2428,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 60}
m_SizeDelta: {x: 400, y: 100}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1681601058
MonoBehaviour:
Expand All @@ -2273,7 +2442,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.7352941, g: 0.7352941, b: 0.7352941, a: 1}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
Expand All @@ -2282,19 +2451,18 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 50
m_FontSize: 40
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 5
m_MinSize: 0
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Timer
m_Text: 'Waiting for overseer to connect...
'
--- !u!222 &1681601059
Expand Down
14 changes: 1 addition & 13 deletions Assets/Scripts/Networking/NetMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ public void CmdOpenDoor(string color)
[Command]
public void CmdStartTimer()
{
Debug.Log(gameObject.name);
var wat = GameObject.Find("host");
Debug.Log(wat.name);
Debug.Break();
if (wat == null)
{
Debug.Break();
}
var ri = wat.GetComponent<Timer>();
print(ri.name);
if (ri == null)
Debug.Break();
ri.StartTimer();
GameObject.FindGameObjectWithTag("PlayerGround").GetComponent<Timer>().StartTimer();
}
}
4 changes: 3 additions & 1 deletion Assets/Timer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ public class Timer : NetworkingCharacterAttachment

public void StartTimer()
{
timer = GameObject.FindGameObjectWithTag("Timer").GetComponent<Text>();

go = true;
spawnTime = Time.time;
timer = GameObject.Find("Timer").GetComponent<Text>();
timer.color = Color.gray;
if (clientsHost)
NetMessenger.Instance.CmdStartTimer();
}
Expand Down
1 change: 1 addition & 0 deletions ProjectSettings/TagManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ TagManager:
- Timer Text
- Home
- Puppy
- Timer
layers:
- Default
- TransparentFX
Expand Down

0 comments on commit 07a54c3

Please sign in to comment.