Added score system and updated shanking with more angles!

This commit is contained in:
shakurass 2014-04-27 15:50:32 -06:00
commit 8cc0583a85
8 changed files with 126 additions and 29 deletions

View file

@ -27,7 +27,7 @@ Transform:
m_GameObject: {fileID: 100000} m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: .100000001, z: .100000001} m_LocalScale: {x: 3, y: .5, z: .5}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
--- !u!23 &2300000 --- !u!23 &2300000
@ -36,7 +36,7 @@ Renderer:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000} m_GameObject: {fileID: 100000}
m_Enabled: 0 m_Enabled: 1
m_CastShadows: 1 m_CastShadows: 1
m_ReceiveShadows: 1 m_ReceiveShadows: 1
m_LightmapIndex: 255 m_LightmapIndex: 255
@ -81,7 +81,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 025a712113e797c408ae9865e9ac79c6, type: 3} m_Script: {fileID: 11500000, guid: 025a712113e797c408ae9865e9ac79c6, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
length: .00999999978 length: .100000001
--- !u!1001 &100100000 --- !u!1001 &100100000
Prefab: Prefab:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View file

@ -853,7 +853,7 @@ Prefab:
- target: {fileID: 11400002, guid: 90277a37311b8fc4bbb1fbb1544e7530, type: 2} - target: {fileID: 11400002, guid: 90277a37311b8fc4bbb1fbb1544e7530, type: 2}
propertyPath: destinations.Array.data[1] propertyPath: destinations.Array.data[1]
value: value:
objectReference: {fileID: 973833183} objectReference: {fileID: 964066619}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 90277a37311b8fc4bbb1fbb1544e7530, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 90277a37311b8fc4bbb1fbb1544e7530, type: 2}
m_RootGameObject: {fileID: 632681052} m_RootGameObject: {fileID: 632681052}
@ -882,7 +882,7 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 493161365} m_GameObject: {fileID: 493161365}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.27643204, y: -5.14518356, z: -6.35511398} m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1592614700} m_Father: {fileID: 1592614700}
@ -1059,6 +1059,56 @@ SphereCollider:
serializedVersion: 2 serializedVersion: 2
m_Radius: .5 m_Radius: .5
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &621151319
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 621151320}
- 132: {fileID: 621151321}
m_Layer: 0
m_Name: Score Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &621151320
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 621151319}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1592614700}
--- !u!132 &621151321
GUIText:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 621151319}
m_Enabled: 1
serializedVersion: 3
m_Text: Score Text
m_Anchor: 2
m_Alignment: 0
m_PixelOffset: {x: -10, y: -10}
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 &632681052 --- !u!1 &632681052
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1147,7 +1197,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
destinations: destinations:
- {fileID: 582022781} - {fileID: 582022781}
- {fileID: 973833183} - {fileID: 964066619}
currentDestIndex: 1 currentDestIndex: 1
--- !u!195 &632681058 --- !u!195 &632681058
NavMeshAgent: NavMeshAgent:
@ -1512,7 +1562,7 @@ Prefab:
- target: {fileID: 11400002, guid: bccc8e6eeff34c1468a1024f0111109c, type: 2} - target: {fileID: 11400002, guid: bccc8e6eeff34c1468a1024f0111109c, type: 2}
propertyPath: destinations.Array.data[0] propertyPath: destinations.Array.data[0]
value: value:
objectReference: {fileID: 582022781} objectReference: {fileID: 964066619}
- target: {fileID: 11400002, guid: bccc8e6eeff34c1468a1024f0111109c, type: 2} - target: {fileID: 11400002, guid: bccc8e6eeff34c1468a1024f0111109c, type: 2}
propertyPath: destinations.Array.data[1] propertyPath: destinations.Array.data[1]
value: value:
@ -1597,7 +1647,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
destinations: destinations:
- {fileID: 582022781} - {fileID: 964066619}
- {fileID: 973833183} - {fileID: 973833183}
currentDestIndex: 1 currentDestIndex: 1
--- !u!195 &912326065 --- !u!195 &912326065
@ -1900,7 +1950,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
destinations: destinations:
- {fileID: 582022781} - {fileID: 582022781}
- {fileID: 973833183} - {fileID: 815705938}
currentDestIndex: 1 currentDestIndex: 1
--- !u!195 &975281920 --- !u!195 &975281920
NavMeshAgent: NavMeshAgent:
@ -1978,8 +2028,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cc84b14a55660b643805ae0f1878c40b, type: 3} m_Script: {fileID: 11500000, guid: cc84b14a55660b643805ae0f1878c40b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
swigs: 99999 swigs: 5
swigText: {fileID: 493161367} swigText: {fileID: 493161367}
scoreText: {fileID: 621151321}
--- !u!4 &1164596950 --- !u!4 &1164596950
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2105,7 +2156,7 @@ Prefab:
- target: {fileID: 11400000, guid: e5c4c39c0dd99f94dbc695a71276c6eb, type: 2} - target: {fileID: 11400000, guid: e5c4c39c0dd99f94dbc695a71276c6eb, type: 2}
propertyPath: destinations.Array.data[1] propertyPath: destinations.Array.data[1]
value: value:
objectReference: {fileID: 973833183} objectReference: {fileID: 815705938}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: e5c4c39c0dd99f94dbc695a71276c6eb, type: 2} m_ParentPrefab: {fileID: 100100000, guid: e5c4c39c0dd99f94dbc695a71276c6eb, type: 2}
m_RootGameObject: {fileID: 975281914} m_RootGameObject: {fileID: 975281914}
@ -2205,9 +2256,10 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1592614699} m_GameObject: {fileID: 1592614699}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.27643204, y: 6.14518356, z: 6.35511398} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 621151320}
- {fileID: 493161366} - {fileID: 493161366}
m_Father: {fileID: 0} m_Father: {fileID: 0}
--- !u!1 &1605196873 --- !u!1 &1605196873

View file

@ -4,6 +4,16 @@ using System.Collections;
public class Demon : MonoBehaviour { public class Demon : MonoBehaviour {
public Renderer characterSprite; public Renderer characterSprite;
private GameController gameController;
void Start() {
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
gameController = gameControllerObject.GetComponent <GameController> ();
else
Debug.Log("Cannot find GameController script.");
}
void OnTriggerEnter(Collider other) { void OnTriggerEnter(Collider other) {
@ -12,6 +22,7 @@ public class Demon : MonoBehaviour {
{ {
//Instantiate (playerExplosion, other.transform.position, other.transform.rotation); //Instantiate (playerExplosion, other.transform.position, other.transform.rotation);
Destroy(gameObject); Destroy(gameObject);
gameController.AddScore();
} }
if (other.tag == "VVAura") { if (other.tag == "VVAura") {

View file

@ -5,10 +5,14 @@ public class GameController : MonoBehaviour {
public int swigs; public int swigs;
public GUIText swigText; public GUIText swigText;
public GUIText scoreText;
private int score = 0;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
UpdateSwigText (); UpdateSwigText ();
UpdateScoreText ();
} }
// Update is called once per frame // Update is called once per frame
@ -21,7 +25,21 @@ public class GameController : MonoBehaviour {
UpdateSwigText(); UpdateSwigText();
} }
public void AddScore() {
score += 100;
UpdateScoreText ();
}
public void DetractScore() {
score -= 150;
UpdateScoreText ();
}
void UpdateSwigText() { void UpdateSwigText() {
swigText.text = "Swigs Left: " + swigs; swigText.text = "Swigs Left: " + swigs;
} }
void UpdateScoreText() {
scoreText.text = "Score: " + score;
}
} }

View file

@ -3,13 +3,24 @@ using System.Collections;
public class Patron : MonoBehaviour { public class Patron : MonoBehaviour {
void OnTriggerEnter(Collider other) { private GameController gameController;
void Start() {
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
gameController = gameControllerObject.GetComponent <GameController> ();
else
Debug.Log("Cannot find GameController script.");
}
void OnTriggerEnter(Collider other) {
//Instantiate(explosion, transform.position, transform.rotation); //Instantiate(explosion, transform.position, transform.rotation);
if (other.tag == "Shank") if (other.tag == "Shank")
{ {
//Instantiate (playerExplosion, other.transform.position, other.transform.rotation); //Instantiate (playerExplosion, other.transform.position, other.transform.rotation);
Destroy(gameObject); Destroy(gameObject);
gameController.DetractScore ();
} }
} }
} }

View file

@ -66,34 +66,39 @@ public class PlayerController : MonoBehaviour {
float moveHorizontal = Input.GetAxis ("Horizontal"); float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical"); float moveVertical = Input.GetAxis ("Vertical");
if (!Mathf.Approximately (moveHorizontal, 0)) { // walking sideways if (moveVertical > 0){ // Walking up
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else if (!Mathf.Approximately(moveVertical, 0)){ // Walking up
animator.SetBool("isWalkingUp", true); animator.SetBool("isWalkingUp", true);
animator.SetBool("isWalking", false); animator.SetBool("isWalking", false);
} }
else if (!Mathf.Approximately (moveHorizontal, 0) || moveVertical < 0) { // walking sideways
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else { else {
animator.SetBool("isWalking", false); animator.SetBool("isWalking", false);
animator.SetBool("isWalkingUp", false); animator.SetBool("isWalkingUp", false);
} }
if (moveHorizontal < 0) { if (moveHorizontal < 0 && moveVertical > 0) // left up
playerAngle.eulerAngles = new Vector3(0f, -135, 0f);
else if (moveHorizontal < 0 && moveVertical < 0) // left down
playerAngle.eulerAngles = new Vector3(0f, -225f, 0f);
else if (moveHorizontal > 0 && moveVertical > 0) //right up
playerAngle.eulerAngles = new Vector3(0f, -45f, 0f);
else if (moveHorizontal > 0 && moveVertical < 0) //right down
playerAngle.eulerAngles = new Vector3(0f, 45f, 0f);
else if (moveHorizontal < 0) { // Stab left
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f); playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
MakePlayerSpriteFace(Direction.Left); MakePlayerSpriteFace(Direction.Left);
} }
if (moveHorizontal > 0) { else if (moveHorizontal > 0) { // Stab right
playerAngle.eulerAngles = new Vector3 (0f, 0f, 0f); playerAngle.eulerAngles = new Vector3 (0f, 0f, 0f);
MakePlayerSpriteFace(Direction.Right); MakePlayerSpriteFace(Direction.Right);
} }
if (moveVertical < 0) else if (moveVertical < 0) // Stab down
playerAngle.eulerAngles = new Vector3(0f, -270f, 0f); playerAngle.eulerAngles = new Vector3(0f, -270f, 0f);
if (moveVertical > 0) else if (moveVertical > 0) // Stab up
playerAngle.eulerAngles = new Vector3(0f, -90f, 0f); playerAngle.eulerAngles = new Vector3(0f, -90f, 0f);
// rigidbody.MovePosition (rigidbody.position + movement * speed * Time.deltaTime);
// rigidbody.position.Normalize ();
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.velocity = movement * speed; rigidbody.velocity = movement * speed;

View file

@ -18,9 +18,9 @@ AnimationClip:
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
value: {fileID: 21300000, guid: 8a7d20d19b593974894a1d833a048e02, type: 3}
- time: .5
value: {fileID: 21300002, guid: 8a7d20d19b593974894a1d833a048e02, type: 3} value: {fileID: 21300002, guid: 8a7d20d19b593974894a1d833a048e02, type: 3}
- time: .166666672
value: {fileID: 21300000, guid: 8a7d20d19b593974894a1d833a048e02, type: 3}
attribute: m_Sprite attribute: m_Sprite
path: path:
classID: 212 classID: 212
@ -33,7 +33,7 @@ AnimationClip:
m_AnimationClipSettings: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
m_StartTime: 0 m_StartTime: 0
m_StopTime: .666666687 m_StopTime: .333333343
m_OrientationOffsetY: 0 m_OrientationOffsetY: 0
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0

View file

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