| @@ -0,0 +1,76 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!21 &2100000 | ||
| Material: | ||
| serializedVersion: 6 | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_Name: sky12 | ||
| m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_ShaderKeywords: | ||
| m_LightmapFlags: 5 | ||
| m_CustomRenderQueue: -1 | ||
| stringTagMap: {} | ||
| m_SavedProperties: | ||
| serializedVersion: 2 | ||
| m_TexEnvs: | ||
| data: | ||
| first: | ||
| name: _MainTex | ||
| second: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _FrontTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 67fe4f6de2a7f2e4dbd62ff499f9000e, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _BackTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 12b8671c1064ed94399359f640c08046, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _LeftTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 395a7ee4e7ecf314b93f33e22509c0e3, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _RightTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 57fd7422cb845ac4387b447fa432c38a, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _UpTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: b467cde969d43bf4cb18996b649d7a47, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _DownTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 223b8b2a58527014fb42da76e6e30b21, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| m_Floats: {} | ||
| m_Colors: | ||
| data: | ||
| first: | ||
| name: _Color | ||
| second: {r: 1, g: 1, b: 1, a: 1} | ||
| data: | ||
| first: | ||
| name: _Tint | ||
| second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} |
| @@ -0,0 +1,76 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!21 &2100000 | ||
| Material: | ||
| serializedVersion: 6 | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_Name: sky13 | ||
| m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_ShaderKeywords: | ||
| m_LightmapFlags: 5 | ||
| m_CustomRenderQueue: -1 | ||
| stringTagMap: {} | ||
| m_SavedProperties: | ||
| serializedVersion: 2 | ||
| m_TexEnvs: | ||
| data: | ||
| first: | ||
| name: _MainTex | ||
| second: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _FrontTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 9085252f967f6b24991a5ece2c6e8c18, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _BackTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: ea51c7762a616e24f9d9a3b2746a6cc5, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _LeftTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: ef7cd91a5c47fe145a46ed45ce1c84c1, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _RightTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: ebdb28d14549ae44d81d58390831f3ad, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _UpTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 678022e3259d83741ba88c5ecbae6d69, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _DownTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 5cc8f104fbbe3f14d979ebbfaadd5974, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| m_Floats: {} | ||
| m_Colors: | ||
| data: | ||
| first: | ||
| name: _Color | ||
| second: {r: 1, g: 1, b: 1, a: 1} | ||
| data: | ||
| first: | ||
| name: _Tint | ||
| second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} |
| @@ -0,0 +1,76 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!21 &2100000 | ||
| Material: | ||
| serializedVersion: 6 | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_Name: sky14 | ||
| m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_ShaderKeywords: | ||
| m_LightmapFlags: 5 | ||
| m_CustomRenderQueue: -1 | ||
| stringTagMap: {} | ||
| m_SavedProperties: | ||
| serializedVersion: 2 | ||
| m_TexEnvs: | ||
| data: | ||
| first: | ||
| name: _MainTex | ||
| second: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _FrontTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 93bffa7cd22778b4ea21df9c78eb866b, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _BackTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 4dcdffe218b75434bb477ccb4a5b80c1, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _LeftTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: e132d1758bfc1ca49bb32517a58c5873, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _RightTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 301c1e2bcec62a340873bf7d9d9e4f28, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _UpTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 2db5abb525593ba469bca5188fbcc73a, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _DownTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: d998c5cd83d4cae41abaed0b3719d0f7, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| m_Floats: {} | ||
| m_Colors: | ||
| data: | ||
| first: | ||
| name: _Color | ||
| second: {r: 1, g: 1, b: 1, a: 1} | ||
| data: | ||
| first: | ||
| name: _Tint | ||
| second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} |
| @@ -0,0 +1,76 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!21 &2100000 | ||
| Material: | ||
| serializedVersion: 6 | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 0} | ||
| m_Name: sky15 | ||
| m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_ShaderKeywords: | ||
| m_LightmapFlags: 5 | ||
| m_CustomRenderQueue: -1 | ||
| stringTagMap: {} | ||
| m_SavedProperties: | ||
| serializedVersion: 2 | ||
| m_TexEnvs: | ||
| data: | ||
| first: | ||
| name: _MainTex | ||
| second: | ||
| m_Texture: {fileID: 0} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _FrontTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: e2df29c7512673948828c1de5d345b69, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _BackTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 234512711fd2ea7468f9220708de708c, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _LeftTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 52ff10d96db650c4eba64d1da9b5b6bd, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _RightTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 03510742b99ef514d8f46aeccd5b6b02, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _UpTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: d82c3ea068ac83d409d3c9422624bf09, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| data: | ||
| first: | ||
| name: _DownTex | ||
| second: | ||
| m_Texture: {fileID: 2800000, guid: 1d3acdbba92446748bdc1ef1da566819, type: 3} | ||
| m_Scale: {x: 1, y: 1} | ||
| m_Offset: {x: 0, y: 0} | ||
| m_Floats: {} | ||
| m_Colors: | ||
| data: | ||
| first: | ||
| name: _Color | ||
| second: {r: 1, g: 1, b: 1, a: 1} | ||
| data: | ||
| first: | ||
| name: _Tint | ||
| second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} |
| @@ -0,0 +1,32 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| public class carDestroy : MonoBehaviour, destructable { | ||
|
|
||
| public GameObject deadCar; | ||
| bool canSub = false; | ||
| Vector3 scale = new Vector3(24.20886f, 24.20886f, 24.20886f); | ||
| // Use this for initialization | ||
| void Start () { | ||
| if (deadCar != null) canSub = true; | ||
| } | ||
|
|
||
|
|
||
| public void CollisionFaker(bullet bulletScript) { | ||
| if (canSub) { | ||
| GameObject newStump = (GameObject)Instantiate(deadCar, gameObject.transform.position, gameObject.transform.rotation); | ||
| newStump.transform.localScale = scale; | ||
| newStump.GetComponent<Renderer>().materials = gameObject.GetComponent<Renderer>().materials; | ||
| newStump.SetActive(true); | ||
| } | ||
| HUDInfo.UpdateDestruction(5); | ||
| AudioDB.destroyTree.Play(); | ||
| Destroy(gameObject); | ||
| } | ||
| public void abductCitizen() { | ||
| return; | ||
| } | ||
| public int getCitizenCount() { | ||
| return 0; | ||
| } | ||
| } |
| @@ -0,0 +1,243 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| public class westWood : MonoBehaviour, destructable { | ||
|
|
||
| public GameObject DM_prefab; | ||
| private GameObject destructMesh; | ||
| public destroyCall destroyScript; | ||
| int citizenCount; | ||
| int rightHitDestructionAmount = 50; | ||
| int weapon1HitDestructionAmount = 20; | ||
| int weapon2HitDestructionAmount = 100; | ||
| int destructionAmount = 1000; //How many points we gain for destroying | ||
|
|
||
|
|
||
| int rightBulletHitCount = 0; | ||
| int leftBulletHitCount = 0; | ||
| int weapon1HitCount = 0; | ||
| int weapon2HitCount = 0; | ||
| int weapon3HitCount = 0; | ||
| int weapon4HitCount = 0; | ||
| int destructionBit; //How many points we gain for hit | ||
| public Vector3 scale; | ||
| public Vector3 newPosition; | ||
| public bool usePosition; | ||
| bool debug = false; | ||
| bool DontGenerate = false; | ||
| public bool resetPosition = false; | ||
| bool isDestroyed = false; | ||
| // Use this for initialization | ||
| void Start () { | ||
| citizenCount = Random.Range(0, 200); | ||
| if (scale.x == 0) { | ||
| scale = new Vector3(1, 1, 1); | ||
| } | ||
| //assign random values to fields | ||
| destructionAmount = Random.Range(100, 500); | ||
| rightHitDestructionAmount = Random.Range(5, 12); | ||
| weapon1HitCount = Random.Range(5, 15); | ||
| weapon2HitCount = Random.Range(25, 75); | ||
|
|
||
|
|
||
| destructionBit = (int)(0.1f * destructionAmount); | ||
| if (!DontGenerate) StartCoroutine(generateColliders()); | ||
| } | ||
| void Update() { | ||
| if (debug && resetPosition && destructMesh != null) { | ||
| resetPosition = false; | ||
| destructMesh.transform.position = gameObject.transform.position; | ||
| Debug.Log("X: " + destructMesh.transform.localScale.x + ", Y: " + destructMesh.transform.localScale.y + ", Z: " + destructMesh.transform.localScale.z); | ||
| } | ||
| } | ||
|
|
||
| IEnumerator generateColliders() { | ||
| Vector3 rotation = gameObject.transform.rotation.eulerAngles; | ||
| rotation.x = 0; | ||
| destructMesh = (GameObject)Instantiate(DM_prefab, gameObject.transform.position, QuanternionHelper.Euler(rotation.x, rotation.y, rotation.z)); | ||
| destructMesh.transform.localScale = scale; | ||
| if (usePosition) { | ||
| destructMesh.transform.position = newPosition; | ||
| } | ||
| else { | ||
| destructMesh.transform.position = gameObject.transform.position; | ||
| } | ||
| Material[] materials = gameObject.GetComponent<Renderer>().materials; | ||
| if (debug) { | ||
| //Debug mode, so don't generate colliders or anything of the sort | ||
| yield break; | ||
| } | ||
| destructMesh.AddComponent<buildDestruct>(); | ||
|
|
||
| int childCount = destructMesh.transform.childCount; | ||
| for (int i = 0; i < childCount; i++) { | ||
| Transform childT = destructMesh.transform.GetChild(i); | ||
| if (childT.name == "Plane") { | ||
| childT.gameObject.SetActive(false); | ||
| Debug.Log("Skipping on: " + gameObject.name); | ||
| continue; | ||
| } | ||
| else { | ||
| childT.GetComponent<Renderer>().materials = materials; | ||
| MeshCollider collider = childT.gameObject.AddComponent<MeshCollider>(); | ||
| Rigidbody rigid = childT.gameObject.AddComponent<Rigidbody>(); | ||
| collider.convex = true; | ||
| rigid.drag = 1; | ||
| rigid.isKinematic = true; //set to false, when actually do simulations | ||
| //childT.gameObject.SetActive(false); | ||
| } | ||
|
|
||
| yield return null; | ||
| } | ||
| destructMesh.SetActive(false); | ||
| for (int i = 0; i < childCount; i++) { | ||
| Transform childT = destructMesh.transform.GetChild(i); | ||
| if (childT.name == "Plane") { | ||
| continue; | ||
| } | ||
| Rigidbody rigid = childT.GetComponent<Rigidbody>(); | ||
| rigid.isKinematic = false; | ||
| } | ||
| } | ||
|
|
||
| void OnCollisionEnter(Collision col) { | ||
| Debug.Log("Colliding!"); | ||
| if (col.rigidbody.gameObject.name == gameObject.name) { | ||
| //colliding with ourselves, ignore | ||
| Debug.Log("Colliding with ourselves"); | ||
| } | ||
| else { | ||
| //Colliding on impactable | ||
| if (col.gameObject.layer == 11) { | ||
| //Debug.Log(gameObject.name + " collided with " + col.gameObject.name); | ||
| bullet bulletScript = col.gameObject.GetComponent<bullet>(); | ||
| int weaponType = -2; | ||
| if (bulletScript != null) { | ||
| weaponType = bulletScript.getType(); | ||
| } | ||
| switch (weaponType) { | ||
| case -1: | ||
| break; | ||
| case 0: | ||
| //Right Trigger | ||
| rightBulletHitCount++; | ||
| if (bulletScript != null) bulletScript.OnCollided(col); | ||
| if (rightBulletHitCount >= rightHitDestructionAmount) { | ||
| Debug.Log("Destroying the building: " + name); | ||
| destructMesh.SetActive(true); | ||
| GameObject.Destroy(gameObject); | ||
| HUDInfo.UpdateDestruction(destructionAmount); | ||
| } | ||
| else { | ||
| HUDInfo.UpdateDestruction(destructionBit); | ||
| } | ||
| break; | ||
| case 1: | ||
| //A weapon | ||
| break; | ||
| case 2: | ||
| break; | ||
| case 3: | ||
| break; | ||
| case 4: | ||
| break; | ||
| default: | ||
| Debug.Log("building collision: unsupported weaponType. Type: " + weaponType); | ||
| break; | ||
| } | ||
| bulletScript.OnCollided(col); | ||
| } | ||
| } | ||
| } | ||
| public void CollisionFaker(bullet bulletScript) { | ||
| if (bulletScript == null) { | ||
| Debug.Log("CollisionFaker null bulletScript!"); | ||
| return; | ||
| } | ||
| //Debug.Log("Calling CollisionFaker()"); | ||
| Debug.Log("bulletScript_type: " + bulletScript.getType()); | ||
| switch (bulletScript.getType()) { | ||
| case -1: | ||
| break; | ||
| case 0: | ||
| //Right Trigger | ||
| rightBulletHitCount++; | ||
| if (rightBulletHitCount >= rightHitDestructionAmount && !isDestroyed) { | ||
| Debug.Log("Destroying the building: " + name); | ||
| destructMesh.SetActive(true); | ||
| GameObject.Destroy(gameObject); | ||
| HUDInfo.UpdateDestruction(destructionAmount); | ||
| AudioDB.destroyBuilding.Play(); | ||
| isDestroyed = true; | ||
| killCitizens(); | ||
| } | ||
| else { | ||
| HUDInfo.UpdateDestruction(destructionBit / rightHitDestructionAmount); | ||
| } | ||
| break; | ||
| case 1: | ||
| //A weapon | ||
| weapon1HitCount++; | ||
| //Debug.Log("A weapon hit, count: " + weapon1HitCount); | ||
| if (weapon1HitCount >= weapon1HitDestructionAmount && !isDestroyed) { | ||
| Debug.Log("Destroying the building: " + name); | ||
| destructMesh.SetActive(true); | ||
| GameObject.Destroy(gameObject); | ||
| HUDInfo.UpdateDestruction(destructionAmount); | ||
| isDestroyed = true; | ||
| AudioDB.destroyBuilding.Play(); | ||
| killCitizens(); | ||
| } | ||
| else { | ||
| HUDInfo.UpdateDestruction(Mathf.Clamp((int)(destructionBit / weapon1HitDestructionAmount),(int)1,(int)100)); | ||
| } | ||
| break; | ||
| case 2: | ||
| //B weapon | ||
| weapon2HitCount++; | ||
| //Debug.Log("B weapon hit, count: " + weapon2HitCount); | ||
| if (weapon2HitCount >= weapon2HitDestructionAmount && !isDestroyed) { | ||
| Debug.Log("Destroying the building: " + name); | ||
| destructMesh.SetActive(true); | ||
| GameObject.Destroy(gameObject); | ||
| HUDInfo.UpdateDestruction(destructionAmount); | ||
| isDestroyed = true; | ||
| AudioDB.destroyBuilding.Play(); | ||
| killCitizens(); | ||
| } | ||
| else { | ||
| HUDInfo.UpdateDestruction(Mathf.Clamp((int)(destructionBit / weapon2HitDestructionAmount), (int)1, (int)100)); | ||
| } | ||
| break; | ||
| case 3: | ||
| break; | ||
| case 4: | ||
| break; | ||
| default: | ||
| Debug.Log("building collision: unsupported weaponType. Type: " + bulletScript.getType()); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| //adds points for each citizen kill | ||
| private void killCitizens() { | ||
| HUDInfo.UpdateDestruction(citizenCount * HUDInfo.citizenWorth); | ||
| } | ||
| public void abductCitizen() { | ||
| if (citizenCount >= 2) { | ||
| HUDInfo.UpdateDestruction(HUDInfo.citizenWorth * 4); | ||
| citizenCount = citizenCount - 2; | ||
| } | ||
| else if (citizenCount == 1) { | ||
| HUDInfo.UpdateDestruction(HUDInfo.citizenWorth * 2); | ||
| citizenCount = citizenCount - 1; | ||
| } | ||
| } | ||
|
|
||
| public int getCitizenCount() { return this.citizenCount; } | ||
| void Destroy() | ||
| { | ||
| GameObject.Find("Input Manager").GetComponent<InputHandler>().endGame(true); | ||
| } | ||
|
|
||
| } |
| @@ -1,2 +1,2 @@ | ||
| m_EditorVersion: 5.3.1f1 | ||
| m_StandardAssetsVersion: 0 |