Patrons now spawn in and are randomly assigned demon status.

This commit is contained in:
shakurass 2014-04-27 19:49:21 -06:00
commit 5d203d1e9d
12 changed files with 111 additions and 1189 deletions

View file

@ -1,186 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 400000}
- 195: {fileID: 19500000}
- 114: {fileID: 11400002}
- 54: {fileID: 5400000}
- 136: {fileID: 13600000}
- 114: {fileID: 11400000}
m_Layer: 0
m_Name: Demon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &100002
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 400002}
- 212: {fileID: 21200000}
- 95: {fileID: 9500000}
m_Layer: 0
m_Name: poser2_0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 8.77135754, y: 9.69999981, z: 4.92175865}
m_LocalScale: {x: 2, y: 3, z: 2}
m_Children:
- {fileID: 400002}
m_Father: {fileID: 0}
--- !u!4 &400002
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100002}
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 6, y: 5, z: 1}
m_Children: []
m_Father: {fileID: 400000}
--- !u!54 &5400000
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: .0500000007
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!95 &9500000
Animator:
serializedVersion: 2
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100002}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 0e6e6ed32792d450e95d8cc18b204166, type: 2}
m_CullingMode: 0
m_ApplyRootMotion: 1
m_AnimatePhysics: 0
m_HasTransformHierarchy: 1
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 40684efec06376d45b9c87a038a40253, type: 3}
m_Name:
m_EditorClassIdentifier:
characterSprite: {fileID: 21200000}
--- !u!114 &11400002
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fc3037736f75b53479f5da8bd507b6eb, type: 3}
m_Name:
m_EditorClassIdentifier:
destinations:
- {fileID: 0}
- {fileID: 0}
currentDestIndex: 1
--- !u!136 &13600000
CapsuleCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: .610000014
m_Height: 1.27999997
m_Direction: 1
m_Center: {x: 0, y: -.0700000003, z: 0}
--- !u!195 &19500000
NavMeshAgent:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_Radius: .5
m_Speed: 5
m_Acceleration: 10000
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 1.00000012
m_BaseOffset: .50000006
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!212 &21200000
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100002}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_LightmapIndex: 255
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
m_Materials:
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_LightProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingLayerID: 0
m_Sprite: {fileID: 21300000, guid: 47c59ffe452059a43afe37861e97dcd6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 100000}
m_IsPrefabParent: 1
m_IsExploded: 1

View file

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 41b19f6c96ad15e4dace633fe1d0a962
NativeFormatImporter:
userData:

View file

@ -100,6 +100,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b933d79988a624405b43ff0fb8c3d527, type: 3}
m_Name:
m_EditorClassIdentifier:
characterSprite: {fileID: 21200000}
--- !u!114 &11400002
MonoBehaviour:
m_ObjectHideFlags: 1
@ -111,9 +112,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fc3037736f75b53479f5da8bd507b6eb, type: 3}
m_Name:
m_EditorClassIdentifier:
destinations:
- {fileID: 0}
- {fileID: 0}
currentDestIndex: 1
--- !u!136 &13600000
CapsuleCollider:

View file

@ -100,9 +100,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fc3037736f75b53479f5da8bd507b6eb, type: 3}
m_Name:
m_EditorClassIdentifier:
destinations:
- {fileID: 0}
- {fileID: 0}
currentDestIndex: 1
--- !u!114 &11400002
MonoBehaviour:
@ -115,6 +112,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b933d79988a624405b43ff0fb8c3d527, type: 3}
m_Name:
m_EditorClassIdentifier:
characterSprite: {fileID: 21200000}
--- !u!136 &13600000
CapsuleCollider:
m_ObjectHideFlags: 1

View file

@ -100,6 +100,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b933d79988a624405b43ff0fb8c3d527, type: 3}
m_Name:
m_EditorClassIdentifier:
characterSprite: {fileID: 21200000}
--- !u!114 &11400002
MonoBehaviour:
m_ObjectHideFlags: 1
@ -111,9 +112,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fc3037736f75b53479f5da8bd507b6eb, type: 3}
m_Name:
m_EditorClassIdentifier:
destinations:
- {fileID: 0}
- {fileID: 0}
currentDestIndex: 1
--- !u!136 &13600000
CapsuleCollider:

File diff suppressed because it is too large Load diff

View file

@ -6,14 +6,14 @@ public class GameController : MonoBehaviour {
public int swigs;
public GUIText swigText;
public GUIText scoreText;
public int patronCount;
public int maxPatrons;
public float spawnWait;
public float startWait;
public float waveWait;
public GameObject[] patron;
public GameObject[] patronObjects;
private int score = 0;
private int patrons = 0;
private int patronCounter = 0;
// Use this for initialization
void Start () {
@ -34,14 +34,14 @@ public class GameController : MonoBehaviour {
while (true)
{
if (patrons < patronCount)
if (patronCounter < maxPatrons)
{
Vector3 spawnPosition = new Vector3 (40f, 2.5f, 10f);
Vector3 spawnPosition = new Vector3 (8f, 9.7f, -3f);
Quaternion spawnRotation = Quaternion.identity;
GameObject patron = Instantiate (patron[Random.Range (0, patron.Length)], spawnPosition, spawnRotation);
Instantiate (patronObjects[Random.Range (0, patronObjects.Length-1)], spawnPosition, spawnRotation);
patrons++;
patronCounter++;
yield return new WaitForSeconds (spawnWait);
}
@ -58,11 +58,13 @@ public class GameController : MonoBehaviour {
public void AddScore() {
score += 100;
UpdateScoreText ();
patronCounter--;
}
public void DetractScore() {
score -= 150;
UpdateScoreText ();
patronCounter--;
}
void UpdateSwigText() {

View file

@ -2,8 +2,10 @@
using System.Collections;
public class Patron : MonoBehaviour {
public Renderer characterSprite;
private GameController gameController;
private bool isDemon = false;
void Start() {
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
@ -12,6 +14,9 @@ public class Patron : MonoBehaviour {
gameController = gameControllerObject.GetComponent <GameController> ();
else
Debug.Log("Cannot find GameController script.");
if (Random.value > 0.6)
isDemon = true;
}
void OnTriggerEnter(Collider other) {
@ -20,7 +25,14 @@ public class Patron : MonoBehaviour {
{
//Instantiate (playerExplosion, other.transform.position, other.transform.rotation);
Destroy(gameObject);
gameController.DetractScore ();
if(isDemon)
gameController.AddScore ();
else
gameController.DetractScore ();
}
if (other.tag == "VVAura" && isDemon) {
characterSprite.renderer.material.color = Color.red;
}
}
}

View file

@ -60,57 +60,69 @@ public class PlayerController : MonoBehaviour {
gameController.TakeSwig();
animator.Play("player_swig");
}
}
void FixedUpdate() {
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
if (moveVertical > 0){ // Walking up
if (moveHorizontal < 0 && moveVertical > 0) { // left up
playerAngle.eulerAngles = new Vector3(0f, -135, 0f);
MakePlayerSpriteFace(Direction.Left);
animator.SetBool("isWalkingUp", true);
animator.SetBool("isWalking", false);
}
else if (!Mathf.Approximately (moveHorizontal, 0) || moveVertical < 0) { // walking sideways
else if (moveHorizontal < 0 && moveVertical < 0) {// left down
playerAngle.eulerAngles = new Vector3(0f, -225f, 0f);
MakePlayerSpriteFace(Direction.Left);
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else if (moveHorizontal > 0 && moveVertical > 0) {//right up
playerAngle.eulerAngles = new Vector3(0f, -45f, 0f);
MakePlayerSpriteFace(Direction.Right);
animator.SetBool("isWalkingUp", true);
animator.SetBool("isWalking", false);
}
else if (moveHorizontal > 0 && moveVertical < 0) {//right down
playerAngle.eulerAngles = new Vector3(0f, 45f, 0f);
MakePlayerSpriteFace(Direction.Right);
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else if (moveHorizontal < 0) { // Stab left
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
MakePlayerSpriteFace(Direction.Left);
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else if (moveHorizontal > 0) { // Stab right
playerAngle.eulerAngles = new Vector3 (0f, 0f, 0f);
MakePlayerSpriteFace(Direction.Right);
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else if (moveVertical < 0) {// Stab down
playerAngle.eulerAngles = new Vector3(0f, -270f, 0f);
animator.SetBool("isWalking", true);
animator.SetBool("isWalkingUp", false);
}
else if (moveVertical > 0) // Stab up
{
playerAngle.eulerAngles = new Vector3(0f, -90f, 0f);
animator.SetBool("isWalkingUp", true);
animator.SetBool("isWalking", false);
}
else {
animator.SetBool("isWalking", false);
animator.SetBool("isWalkingUp", false);
}
if (moveHorizontal < 0 && moveVertical > 0) { // left up
playerAngle.eulerAngles = new Vector3(0f, -135, 0f);
MakePlayerSpriteFace(Direction.Left);
}
else if (moveHorizontal < 0 && moveVertical < 0) {// left down
playerAngle.eulerAngles = new Vector3(0f, -225f, 0f);
MakePlayerSpriteFace(Direction.Left);
}
else if (moveHorizontal > 0 && moveVertical > 0) {//right up
playerAngle.eulerAngles = new Vector3(0f, -45f, 0f);
MakePlayerSpriteFace(Direction.Right);
}
else if (moveHorizontal > 0 && moveVertical < 0) {//right down
playerAngle.eulerAngles = new Vector3(0f, 45f, 0f);
MakePlayerSpriteFace(Direction.Right);
}
else if (moveHorizontal < 0) { // Stab left
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
MakePlayerSpriteFace(Direction.Left);
}
else if (moveHorizontal > 0) { // Stab right
playerAngle.eulerAngles = new Vector3 (0f, 0f, 0f);
MakePlayerSpriteFace(Direction.Right);
}
else if (moveVertical < 0) // Stab down
playerAngle.eulerAngles = new Vector3(0f, -270f, 0f);
else if (moveVertical > 0) // Stab up
playerAngle.eulerAngles = new Vector3(0f, -90f, 0f);
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.velocity = movement * speed;
rigidbody.freezeRotation = true;
}
void FixedUpdate() {
}
}

View file

@ -3,12 +3,23 @@ using System.Collections;
public class WalkAI : MonoBehaviour {
public GameObject[] destinations;
private GameObject[] destinations;
public int currentDestIndex = 0;
private NavMeshAgent nva;
void Awake() {
GameObject[] allPois = GameObject.FindGameObjectsWithTag("pois");
GameObject poi1 = allPois[Random.Range (0, allPois.Length)];
GameObject poi2 = allPois[Random.Range (0, allPois.Length)];
destinations = new GameObject[2] {
poi1,
poi2
};
nva = GetComponent<NavMeshAgent>();
nva.updateRotation = false;
nva.SetDestination(destinations[currentDestIndex].transform.position);

View file

@ -18,7 +18,7 @@ Material:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: aad1c3a7e9be2d84ebed6243e1a7541b, type: 3}
m_Scale: {x: 8, y: 3.43000007}
m_Scale: {x: 10, y: 10}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors: