added score ui and update-score animations

This commit is contained in:
Steven 2017-10-14 18:53:16 -05:00
parent e518a5d87f
commit b9419896a8
14 changed files with 976 additions and 69 deletions

View file

@ -1,7 +1,8 @@
using UnityEngine;
using System;
using UnityEngine;
[System.Serializable]
public struct HSBColor
public struct HSBColor : IEquatable<HSBColor>
{
public float h;
public float s;
@ -221,4 +222,9 @@ public struct HSBColor
Debug.Log("164,82,84 .... 0.643137f, 0.321568f, 0.329411f :" + ToColor(new HSBColor(new Color(0.643137f, 0.321568f, 0.329411f))));
}
public bool Equals(HSBColor other)
{
return Mathf.Abs((h - other.h)) < 0.01f && Mathf.Abs((s - other.s)) < 0.01f && Mathf.Abs((b - other.b)) < 0.01f && Mathf.Abs((a - other.a)) < 0.01f;
}
}

View file

@ -144,7 +144,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_BackGroundColor: {r: 0.25, g: 0.25, b: 0.25, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0

View file

@ -176,6 +176,199 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 3938152}
--- !u!1 &59439889
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 59439890}
- component: {fileID: 59439892}
- component: {fileID: 59439891}
m_Layer: 5
m_Name: TimerText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &59439890
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 59439889}
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: 62720020}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &59439891
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 59439889}
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: 1, g: 1, b: 1, 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: 21
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 0:00
--- !u!222 &59439892
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 59439889}
--- !u!1 &62720019
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 62720020}
- component: {fileID: 62720022}
- component: {fileID: 62720021}
- component: {fileID: 62720023}
- component: {fileID: 62720024}
m_Layer: 5
m_Name: ScorePanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &62720020
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 62720019}
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:
- {fileID: 1476265757}
- {fileID: 1281261005}
- {fileID: 59439890}
- {fileID: 1409286883}
- {fileID: 1530037538}
m_Father: {fileID: 1711455460}
m_RootOrder: 2
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: 400, y: 40}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &62720021
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 62720019}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.328}
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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &62720022
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 62720019}
--- !u!114 &62720023
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 62720019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3}
m_Name:
m_EditorClassIdentifier:
ownerId: 0
group: 0
OwnerShipWasTransfered: 0
prefixBackup: -1
synchronization: 0
onSerializeTransformOption: 3
onSerializeRigidBodyOption: 2
ownershipTransfer: 0
ObservedComponents: []
ObservedComponentsFoldoutOpen: 1
viewIdField: 1
instantiationId: 1
currentMasterID: -1
isRuntimeInstantiated: 0
--- !u!114 &62720024
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 62720019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ed9bfa14979ce36469ee284add674c83, type: 3}
m_Name:
m_EditorClassIdentifier:
_timerText: {fileID: 59439891}
winText: {fileID: 0}
_guardScore: {fileID: 1631539349}
_spyScore: {fileID: 225134303}
missionsCompleteText: {fileID: 0}
winPanel: {fileID: 0}
guardPanel: {fileID: 0}
spyPanel: {fileID: 0}
--- !u!1 &99008743
GameObject:
m_ObjectHideFlags: 0
@ -318,6 +511,74 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 120123398}
--- !u!1 &225134301
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 225134302}
- component: {fileID: 225134304}
- component: {fileID: 225134303}
m_Layer: 5
m_Name: ScoreBar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &225134302
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 225134301}
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: 1530037538}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -2.5, y: 0}
m_SizeDelta: {x: 103, y: 15}
m_Pivot: {x: 1, y: 0.5}
--- !u!114 &225134303
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 225134301}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 0.594, 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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &225134304
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 225134301}
--- !u!1 &231738595
GameObject:
m_ObjectHideFlags: 0
@ -1422,6 +1683,74 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1169398161}
--- !u!1 &1281261004
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1281261005}
- component: {fileID: 1281261007}
- component: {fileID: 1281261006}
m_Layer: 5
m_Name: SpySprite
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1281261005
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1281261004}
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: 62720020}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -5, y: 0}
m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 1, y: 0.5}
--- !u!114 &1281261006
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1281261004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_Sprite: {fileID: 21300000, guid: 51df7eb9a0e478c4f8393a275e950f17, type: 3}
m_Type: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1281261007
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1281261004}
--- !u!1 &1285637234
GameObject:
m_ObjectHideFlags: 0
@ -1599,14 +1928,75 @@ MonoBehaviour:
cameraRigPrefab: {fileID: 1009033979625728, guid: 1764211b5690c164d82aa46fa4ec707d,
type: 2}
numNpcs: 10
spyMissionsComplete: 0
waitBetweenMissions: 5
onMissionCooldown: 0
missionsCompleteText: {fileID: 0}
winPanel: {fileID: 0}
guardPanel: {fileID: 0}
spyPanel: {fileID: 0}
winText: {fileID: 0}
--- !u!1 &1409286882
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1409286883}
- component: {fileID: 1409286885}
- component: {fileID: 1409286884}
m_Layer: 5
m_Name: GuardScore
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1409286883
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1409286882}
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:
- {fileID: 1631539348}
m_Father: {fileID: 62720020}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 60, y: 0}
m_SizeDelta: {x: 108.4, y: 20}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1409286884
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1409286882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.328}
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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1409286885
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1409286882}
--- !u!1 &1437119776
GameObject:
m_ObjectHideFlags: 0
@ -1661,6 +2051,143 @@ MonoBehaviour:
type: 2}
requestPanel: {fileID: 1290216653}
requestedInteractionText: {fileID: 1169398163}
--- !u!1 &1476265756
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1476265757}
- component: {fileID: 1476265759}
- component: {fileID: 1476265758}
m_Layer: 5
m_Name: GuardSprite
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1476265757
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476265756}
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: 62720020}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 5, y: 0}
m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1476265758
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476265756}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_Sprite: {fileID: 21300000, guid: a47b41bbfb07e2b4ca148f318e944056, type: 3}
m_Type: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1476265759
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476265756}
--- !u!1 &1530037537
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1530037538}
- component: {fileID: 1530037540}
- component: {fileID: 1530037539}
m_Layer: 5
m_Name: SpyScore
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1530037538
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1530037537}
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:
- {fileID: 225134302}
m_Father: {fileID: 62720020}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -60, y: 0}
m_SizeDelta: {x: 108.399994, y: 20}
m_Pivot: {x: 1, y: 0.5}
--- !u!114 &1530037539
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1530037537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.328}
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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1530037540
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1530037537}
--- !u!1 &1617739639
GameObject:
m_ObjectHideFlags: 0
@ -1730,6 +2257,74 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1617739639}
--- !u!1 &1631539347
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1631539348}
- component: {fileID: 1631539350}
- component: {fileID: 1631539349}
m_Layer: 5
m_Name: ScoreBar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1631539348
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1631539347}
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: 1409286883}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 2.5, y: 0}
m_SizeDelta: {x: 103, y: 15}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1631539349
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1631539347}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 0.594, 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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1631539350
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1631539347}
--- !u!114 &1654923637 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 114306799516802978, guid: c67fa24334c0f364cad8798522e92116,
@ -1823,6 +2418,7 @@ RectTransform:
m_Children:
- {fileID: 356728719}
- {fileID: 1437119777}
- {fileID: 62720020}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2119,6 +2715,11 @@ Prefab:
propertyPath: spotLight
value:
objectReference: {fileID: 2060245569}
- target: {fileID: 20437103875467350, guid: c67fa24334c0f364cad8798522e92116,
type: 2}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2}
m_IsPrefabParent: 0

View file

@ -47,6 +47,6 @@ public class Interaction : ScriptableObject
//--------------------------------- Result functions ---------------------------------
void SpyMissionComplete(StateController controller)
{
Debug.Log("Completed mission");
ScorePanelController.CompleteMission();
}
}

View file

@ -48,6 +48,7 @@ public class State : ScriptableObject
if (decisionSucceeded)
{
controller.TransitionToState(transitions[i].trueState);
break;
}
}
}

View file

@ -88,7 +88,6 @@ public class StateController : SelectableObject
}
}
// Initiates interaction with other StateController
public void InitiateInteractionWithSelectedObject()
{
if (SelectedObject == this)
@ -153,7 +152,6 @@ public class StateController : SelectableObject
return SelectedObject.Interactor != this;
}
public void FinishInteraction()
{
if (IsInteracting)
@ -184,8 +182,6 @@ public class StateController : SelectableObject
}
}
public void StartRoaming()
{
_roamCoroutine = StartCoroutine(Roam());

View file

@ -10,15 +10,7 @@ public class GameManager : Photon.PunBehaviour {
public GuardCameraController guardCamera;
public GameObject spyPrefab, NPCPrefab, cameraRigPrefab;
public int numNpcs = 9;
public int spyMissionsComplete = 0;
public float waitBetweenMissions = 5.0f;
public bool onMissionCooldown = false;
public Text missionsCompleteText;
public GameObject winPanel;
public GameObject guardPanel;
public GameObject spyPanel;
public Text winText;
private int numOfMissions = 3;
public override void OnLeftRoom()
{
@ -69,52 +61,11 @@ public class GameManager : Photon.PunBehaviour {
PhotonNetwork.Instantiate(NPCPrefab.name, randPos, Quaternion.identity, 0);
}
}
}
public void CompleteMission()
{
if (!PhotonNetwork.isMasterClient || onMissionCooldown)
return;
StartCoroutine(MissionCooldown());
spyMissionsComplete++;
photonView.RPC("CompleteMissionRPC", PhotonTargets.All, spyMissionsComplete);
if (spyMissionsComplete >= numOfMissions)
photonView.RPC("ShowSpiesWinScreen", PhotonTargets.All);
}
[PunRPC]
void SpawnNPC(Vector3 pos)
{
Instantiate(NPCPrefab, pos, Quaternion.identity);
}
[PunRPC]
void CompleteMissionRPC(int missionsCompleted)
{
spyMissionsComplete = missionsCompleted;
missionsCompleteText.text = spyMissionsComplete + "/3";
}
[PunRPC]
void ShowSpiesWinScreen()
void SpawnNPC(Vector3 pos)
{
winPanel.SetActive(true);
winText.text = "SPIES WIN!";
}
[PunRPC]
void ShowGuardsWinScreen()
{
winPanel.SetActive(true);
winText.text = "GUARDS WIN!";
}
IEnumerator MissionCooldown()
{
onMissionCooldown = true;
yield return new WaitForSeconds(waitBetweenMissions);
onMissionCooldown = false;
Instantiate(NPCPrefab, pos, Quaternion.identity);
}
}

View file

@ -53,7 +53,7 @@ public class InteractionPanelController : MonoBehaviour {
var data = new InteractionData(interaction, false);
optionsList.Add(data);
}
if (controller.SelectedObject.CompareTag("Spy"))
if (true || controller.SelectedObject.CompareTag("Spy"))
{
foreach (Interaction interaction in controller.SelectedObject.spyInteractions)
{

View file

@ -0,0 +1,176 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScorePanelController : Photon.PunBehaviour {
public Text _timerText, winText;
public Image _guardScore, _spyScore;
public Text missionsCompleteText;
public GameObject winPanel;
public GameObject guardPanel;
public GameObject spyPanel;
private int _numOfMissions = 3;
private int _missionsComplete = 0;
private float waitBetweenMissions = 5.0f;
private bool onMissionCooldown = false;
private float _initalScoreWidth;
private static ScorePanelController ActivePanel;
void Start () {
if (!ActivePanel)
ActivePanel = this;
else
Debug.LogError("Two ScorePanelControllers in the scene");
StartCoroutine(TimerUpdate());
// Initialize scorebar variables
_initalScoreWidth = _spyScore.rectTransform.sizeDelta.x;
_spyScore.rectTransform.sizeDelta = new Vector2(-1, _spyScore.rectTransform.sizeDelta.y);
_guardScore.rectTransform.sizeDelta = new Vector2(-1, _guardScore.rectTransform.sizeDelta.y);
}
public static void CompleteMission()
{
if (ActivePanel.onMissionCooldown)
return;
ActivePanel.photonView.RPC("CompleteMissionRPC", PhotonTargets.All);
}
#region Coroutines
IEnumerator TimerUpdate()
{
while (true)
{
yield return new WaitForEndOfFrame();
int seconds = (int)Time.timeSinceLevelLoad;
int minutes = seconds / 60;
seconds = seconds % 60;
string timeString = "";
if (seconds < 10)
timeString = minutes.ToString() + ":0" + seconds.ToString();
else
timeString = minutes.ToString() + ":" + seconds.ToString();
_timerText.text = timeString;
}
}
IEnumerator IncreaseScoreBarAnimation(Image scoreBar, float progress)
{
Color originalColor = scoreBar.color;
var flashCoroutine = StartCoroutine(FlashScoreBar(scoreBar));
float targetWidth = _initalScoreWidth * progress;
float overshotWidth = targetWidth * 1.2f;
while (true)
{
Vector2 sizeDelta = scoreBar.rectTransform.sizeDelta;
float newWidth = Mathf.Lerp(sizeDelta.x, overshotWidth, Time.deltaTime * 0.8f);
if (sizeDelta.x < targetWidth)
{
scoreBar.rectTransform.sizeDelta = new Vector2(newWidth, sizeDelta.y);
yield return new WaitForEndOfFrame();
}
else
{
scoreBar.rectTransform.sizeDelta = new Vector2(targetWidth, sizeDelta.y);
break;
}
}
StopCoroutine(flashCoroutine);
StartCoroutine(ResetScoreBarColor(scoreBar, originalColor));
yield return null;
}
IEnumerator FlashScoreBar(Image scoreBar)
{
Color darkerColor = scoreBar.color;
darkerColor.r *= 0.5f;
darkerColor.g *= 0.5f;
darkerColor.b *= 0.5f;
HSBColor darkColor = HSBColor.FromColor(darkerColor);
HSBColor flashColor = HSBColor.FromColor(Color.yellow);
HSBColor currentColor = darkColor;
bool pingPong = true;
float time = 0.0f;
while (true)
{
float elapsedTime = Time.deltaTime * 2.0f;
if (pingPong)
time += elapsedTime;
else
time -= elapsedTime;
time = Mathf.Clamp01(time);
if (time == 0.0f)
pingPong = true;
else if (time == 1.0f)
pingPong = false;
currentColor = HSBColor.Lerp(darkColor, flashColor, time);
scoreBar.color = currentColor.ToColor();
yield return new WaitForEndOfFrame();
}
}
IEnumerator ResetScoreBarColor(Image scoreBar, Color originalColor)
{
float time = 0.0f;
HSBColor startColor = HSBColor.FromColor(scoreBar.color);
HSBColor endColor = HSBColor.FromColor(originalColor);
HSBColor currentColor = startColor;
while (true)
{
time += Time.deltaTime * 2.0f;
time = Mathf.Clamp01(time);
currentColor = HSBColor.Lerp(startColor, endColor, time);
scoreBar.color = currentColor.ToColor();
if (time >= 0.90f)
{
scoreBar.color = originalColor;
break;
}
yield return new WaitForEndOfFrame();
}
yield return null;
}
IEnumerator MissionCooldown()
{
onMissionCooldown = true;
yield return new WaitForSeconds(waitBetweenMissions);
onMissionCooldown = false;
}
#endregion
#region PunRPC
[PunRPC]
void CompleteMissionRPC()
{
Debug.Log("Mission Completed!");
_missionsComplete++;
StartCoroutine(MissionCooldown());
StartCoroutine(IncreaseScoreBarAnimation(_spyScore, (float)_missionsComplete / _numOfMissions));
/*if (_missionsComplete >= _numOfMissions)
photonView.RPC("ShowSpiesWinScreen", PhotonTargets.All);*/
}
[PunRPC]
void ShowSpiesWinScreen()
{
winPanel.SetActive(true);
winText.text = "SPIES WIN!";
}
[PunRPC]
void ShowGuardsWinScreen()
{
winPanel.SetActive(true);
winText.text = "GUARDS WIN!";
}
#endregion
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ed9bfa14979ce36469ee284add674c83
timeCreated: 1508017086
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -0,0 +1,82 @@
fileFormatVersion: 2
guid: 51df7eb9a0e478c4f8393a275e950f17
timeCreated: 1508015222
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -0,0 +1,82 @@
fileFormatVersion: 2
guid: a47b41bbfb07e2b4ca148f318e944056
timeCreated: 1508015222
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant: