Added game over state.

This commit is contained in:
shakurass 2014-04-27 20:59:59 -06:00
commit 0306357af8
3 changed files with 256 additions and 69 deletions

View file

@ -257,7 +257,7 @@ GameObject:
- 54: {fileID: 146718574}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -861,6 +861,56 @@ GUIText:
rgba: 4294967295
m_PixelCorrect: 1
m_RichText: 1
--- !u!1 &644799322
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 644799323}
- 132: {fileID: 644799324}
m_Layer: 0
m_Name: Shankyou Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &644799323
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 644799322}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: .5, y: .419999987, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1592614700}
--- !u!132 &644799324
GUIText:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 644799322}
m_Enabled: 0
serializedVersion: 3
m_Text: Shank you very much!
m_Anchor: 0
m_Alignment: 0
m_PixelOffset: {x: 0, y: 0}
m_LineSpacing: 1
m_TabSize: 4
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Material: {fileID: 0}
m_FontSize: 29
m_FontStyle: 0
m_Color:
serializedVersion: 2
rgba: 4294967295
m_PixelCorrect: 1
m_RichText: 1
--- !u!1 &659898285
GameObject:
m_ObjectHideFlags: 0
@ -1133,12 +1183,16 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400050, guid: c2a599d40f95a644fb16f5f31c9d3c2c, type: 2}
propertyPath: m_LocalPosition.z
value: 8.85427189
value: 9.01995087
objectReference: {fileID: 0}
- target: {fileID: 400050, guid: c2a599d40f95a644fb16f5f31c9d3c2c, type: 2}
propertyPath: m_LocalScale.z
value: 12.6073637
objectReference: {fileID: 0}
- target: {fileID: 400050, guid: c2a599d40f95a644fb16f5f31c9d3c2c, type: 2}
propertyPath: m_LocalScale.y
value: .5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c2a599d40f95a644fb16f5f31c9d3c2c, type: 2}
m_RootGameObject: {fileID: 1731015426}
@ -1453,6 +1507,56 @@ Transform:
m_LocalScale: {x: 1.93007195, y: 1.93007195, z: 1.93007195}
m_Children: []
m_Father: {fileID: 523078142}
--- !u!1 &973833017
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 973833018}
- 132: {fileID: 973833019}
m_Layer: 0
m_Name: Gameover Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &973833018
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 973833017}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: .5, y: .5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1592614700}
--- !u!132 &973833019
GUIText:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 973833017}
m_Enabled: 0
serializedVersion: 3
m_Text: Game Over
m_Anchor: 4
m_Alignment: 0
m_PixelOffset: {x: 0, y: 0}
m_LineSpacing: 1
m_TabSize: 4
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Material: {fileID: 0}
m_FontSize: 107
m_FontStyle: 0
m_Color:
serializedVersion: 2
rgba: 4294967295
m_PixelCorrect: 1
m_RichText: 1
--- !u!1 &973833183
GameObject:
m_ObjectHideFlags: 0
@ -1819,7 +1923,6 @@ GameObject:
m_Component:
- 4: {fileID: 1164596950}
- 114: {fileID: 1164596949}
- 82: {fileID: 1164596951}
m_Layer: 0
m_Name: GameController
m_TagString: GameController
@ -1838,7 +1941,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cc84b14a55660b643805ae0f1878c40b, type: 3}
m_Name:
m_EditorClassIdentifier:
swigs: 10
swigs: 1
swigText: {fileID: 493161367}
scoreText: {fileID: 621151321}
maxPatrons: 10
@ -1849,6 +1952,9 @@ MonoBehaviour:
- {fileID: 100002, guid: 90277a37311b8fc4bbb1fbb1544e7530, type: 2}
- {fileID: 100002, guid: e5c4c39c0dd99f94dbc695a71276c6eb, type: 2}
- {fileID: 100000, guid: bccc8e6eeff34c1468a1024f0111109c, type: 2}
shankYouText: {fileID: 644799324}
gameOverText: {fileID: 973833019}
restartText: {fileID: 1894191159}
--- !u!4 &1164596950
Transform:
m_ObjectHideFlags: 0
@ -1860,64 +1966,6 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
--- !u!82 &1164596951
AudioSource:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1164596948}
m_Enabled: 1
serializedVersion: 3
m_audioClip: {fileID: 8300000, guid: 38bfc99e65cfc8f4bb53f50021693720, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 1
Mute: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!1 &1195109751
GameObject:
m_ObjectHideFlags: 0
@ -2389,6 +2437,9 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 973833018}
- {fileID: 1894191158}
- {fileID: 644799323}
- {fileID: 621151320}
- {fileID: 493161366}
m_Father: {fileID: 0}
@ -2714,8 +2765,8 @@ Transform:
m_PrefabInternal: {fileID: 752434186}
m_GameObject: {fileID: 1840477154}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 29.5528221, y: 0, z: 8.85427189}
m_LocalScale: {x: 29.2999992, y: 1, z: 12.6073637}
m_LocalPosition: {x: 29.5528221, y: 0, z: 9.01995087}
m_LocalScale: {x: 29.2999992, y: .5, z: 12.6073637}
m_Children: []
m_Father: {fileID: 1731015427}
--- !u!23 &1840477156
@ -2854,6 +2905,56 @@ SpriteRenderer:
m_SortingLayerID: 0
m_Sprite: {fileID: 21300000, guid: a8790e3080b6f134c9146700b51820a4, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
--- !u!1 &1894191157
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1894191158}
- 132: {fileID: 1894191159}
m_Layer: 0
m_Name: Restart Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1894191158
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1894191157}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: .5, y: .340000004, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1592614700}
--- !u!132 &1894191159
GUIText:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1894191157}
m_Enabled: 0
serializedVersion: 3
m_Text: Press 'R' to restart.
m_Anchor: 0
m_Alignment: 0
m_PixelOffset: {x: 0, y: 0}
m_LineSpacing: 1
m_TabSize: 4
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Material: {fileID: 0}
m_FontSize: 20
m_FontStyle: 0
m_Color:
serializedVersion: 2
rgba: 4294967295
m_PixelCorrect: 1
m_RichText: 1
--- !u!1 &1906971092
GameObject:
m_ObjectHideFlags: 0
@ -3014,6 +3115,7 @@ GameObject:
- 124: {fileID: 2004495482}
- 81: {fileID: 2004495481}
- 114: {fileID: 2004495486}
- 82: {fileID: 2004495487}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -3094,6 +3196,64 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
player: {fileID: 146718571}
--- !u!82 &2004495487
AudioSource:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2004495480}
m_Enabled: 1
serializedVersion: 3
m_audioClip: {fileID: 8300000, guid: 38bfc99e65cfc8f4bb53f50021693720, type: 3}
m_PlayOnAwake: 1
m_Volume: .100000001
m_Pitch: 1
Loop: 1
Mute: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!1 &2009917412
GameObject:
m_ObjectHideFlags: 0

View file

@ -12,20 +12,32 @@ public class GameController : MonoBehaviour {
public float waveWait;
public GameObject[] patronObjects;
public GUIText shankYouText;
public GUIText gameOverText;
public GUIText restartText;
private int score = 0;
private int patronCounter = 0;
private bool restart;
private int maxSwigs;
// Use this for initialization
void Start () {
maxSwigs = swigs;
restart = false;
UpdateSwigText ();
UpdateScoreText ();
StartCoroutine (SpawnWaves ());
}
// Update is called once per frame
void Update () {
if (restart) {
if (Input.GetKeyDown(KeyCode.R))
Application.LoadLevel(Application.loadedLevel);
}
}
IEnumerator SpawnWaves ()
@ -47,6 +59,21 @@ public class GameController : MonoBehaviour {
}
yield return new WaitForSeconds (waveWait);
if (swigs == 0)
{
yield return new WaitForSeconds (5);
shankYouText.enabled = true;
gameOverText.enabled = true;
restartText.enabled = true;
restart = true;
GameObject.FindGameObjectWithTag ("Player").SetActive (false);
break;
}
}
}
@ -68,7 +95,7 @@ public class GameController : MonoBehaviour {
}
void UpdateSwigText() {
swigText.text = "Swigs Left: " + swigs;
swigText.text = "Swigs Left: " + swigs + " / " + maxSwigs;
}
void UpdateScoreText() {

View file

@ -19,7 +19,7 @@ Material:
second:
m_Texture: {fileID: 2800000, guid: 26c9dff0fed396341b045e42e3a0b500, type: 3}
m_Scale: {x: 1, y: .5}
m_Offset: {x: 0, y: 0}
m_Offset: {x: 0, y: .5}
data:
first:
name: _BumpMap