diff options
-rw-r--r-- | nGJ2019/Assets/Models/health_crystal.fbx | bin | 0 -> 15436 bytes | |||
-rw-r--r-- | nGJ2019/Assets/Models/health_crystal.fbx.meta | 94 | ||||
-rw-r--r-- | nGJ2019/Assets/Prefabs/health_crystal.prefab | 128 | ||||
-rw-r--r-- | nGJ2019/Assets/Prefabs/health_crystal.prefab.meta | 7 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/DragonMovement.cs | 12 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/EnemyCollider.cs | 8 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/EventTimeline.cs | 10 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/HealthBar.cs | 54 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/ObstacleSpawner.cs | 4 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/ObstacleType.cs | 5 | ||||
-rw-r--r-- | nGJ2019/Assets/Textures/crystal_dead.mat | 77 | ||||
-rw-r--r-- | nGJ2019/Assets/Textures/crystal_dead.mat.meta | 8 | ||||
-rw-r--r-- | nGJ2019/Assets/Textures/crystal_live.mat | 77 | ||||
-rw-r--r-- | nGJ2019/Assets/Textures/crystal_live.mat.meta | 8 |
14 files changed, 484 insertions, 8 deletions
diff --git a/nGJ2019/Assets/Models/health_crystal.fbx b/nGJ2019/Assets/Models/health_crystal.fbx Binary files differnew file mode 100644 index 0000000..6698220 --- /dev/null +++ b/nGJ2019/Assets/Models/health_crystal.fbx diff --git a/nGJ2019/Assets/Models/health_crystal.fbx.meta b/nGJ2019/Assets/Models/health_crystal.fbx.meta new file mode 100644 index 0000000..db5a5c5 --- /dev/null +++ b/nGJ2019/Assets/Models/health_crystal.fbx.meta @@ -0,0 +1,94 @@ +fileFormatVersion: 2 +guid: fe4f2cdeb6d4d7e41809b08237be2025 +ModelImporter: + serializedVersion: 25 + internalIDToNameTable: [] + externalObjects: {} + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/nGJ2019/Assets/Prefabs/health_crystal.prefab b/nGJ2019/Assets/Prefabs/health_crystal.prefab new file mode 100644 index 0000000..8b52814 --- /dev/null +++ b/nGJ2019/Assets/Prefabs/health_crystal.prefab @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6136547117420934535 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8277819564996884} + m_Layer: 0 + m_Name: health_crystal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8277819564996884 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6136547117420934535} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.1396179, y: -0.6755286, z: 2.9882812} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7434249188869609042} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &2472888448866237768 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8277819564996884} + m_Modifications: + - target: {fileID: -927199367670048503, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_Name + value: health_crystal + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalPosition.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071067 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalScale.x + value: 70 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalScale.y + value: 70 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_LocalScale.z + value: 70 + objectReference: {fileID: 0} + - target: {fileID: -1504981713932161579, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: d19c2d3c342b20c46b03be1f5369081d, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: fe4f2cdeb6d4d7e41809b08237be2025, type: 3} +--- !u!4 &7434249188869609042 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: fe4f2cdeb6d4d7e41809b08237be2025, + type: 3} + m_PrefabInstance: {fileID: 2472888448866237768} + m_PrefabAsset: {fileID: 0} diff --git a/nGJ2019/Assets/Prefabs/health_crystal.prefab.meta b/nGJ2019/Assets/Prefabs/health_crystal.prefab.meta new file mode 100644 index 0000000..7d6199f --- /dev/null +++ b/nGJ2019/Assets/Prefabs/health_crystal.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 22d3f1e2dafbf414e9a2d04e1a5ec602 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/nGJ2019/Assets/Scripts/DragonMovement.cs b/nGJ2019/Assets/Scripts/DragonMovement.cs index 04f1c3a..4ba179d 100644 --- a/nGJ2019/Assets/Scripts/DragonMovement.cs +++ b/nGJ2019/Assets/Scripts/DragonMovement.cs @@ -12,6 +12,8 @@ public class DragonMovement : MonoBehaviour public float horizontalBound = 6f; public float verticalBound = 4f; + public HealthBar healthBar; + private SwarmSystem swarm; private enum State {normal, swirl, slim, spread}; @@ -198,4 +200,14 @@ public class DragonMovement : MonoBehaviour Gizmos.DrawWireCube(Vector3.zero, new Vector3(2*horizontalBound, 2*verticalBound, 0)); } + void OnTriggerEnter(Collider other) + { + EnemyCollider enemy = other.gameObject.GetComponent<EnemyCollider>(); + if(enemy != null) + { + Debug.Log(enemy.type == ObstacleType.alfa ? "alfa hit" : "beta hit"); + healthBar.health--; + } + } + }
\ No newline at end of file diff --git a/nGJ2019/Assets/Scripts/EnemyCollider.cs b/nGJ2019/Assets/Scripts/EnemyCollider.cs new file mode 100644 index 0000000..89144d9 --- /dev/null +++ b/nGJ2019/Assets/Scripts/EnemyCollider.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class EnemyCollider : MonoBehaviour +{ + public ObstacleType type; +} diff --git a/nGJ2019/Assets/Scripts/EventTimeline.cs b/nGJ2019/Assets/Scripts/EventTimeline.cs index 1aef359..21b0bdb 100644 --- a/nGJ2019/Assets/Scripts/EventTimeline.cs +++ b/nGJ2019/Assets/Scripts/EventTimeline.cs @@ -4,15 +4,13 @@ using System.Collections.Generic; public class EventTimeline { - public enum SpawnEventType {alfa, beta}; - - public class SpawnEvent + public class SpawnEvent { public float time; public float height; - public SpawnEventType type; + public ObstacleType type; - public SpawnEvent(float time, float height, SpawnEventType type) + public SpawnEvent(float time, float height, ObstacleType type) { this.time = time; this.height = height; @@ -31,7 +29,7 @@ public class EventTimeline currentTime = 0; } - public void Add(float time, float height, SpawnEventType type) + public void Add(float time, float height, ObstacleType type) { futureEvents.Add(new SpawnEvent(time, height, type)); futureEvents.Sort((x,y) => x.time.CompareTo(y.time)); diff --git a/nGJ2019/Assets/Scripts/HealthBar.cs b/nGJ2019/Assets/Scripts/HealthBar.cs new file mode 100644 index 0000000..4c30b42 --- /dev/null +++ b/nGJ2019/Assets/Scripts/HealthBar.cs @@ -0,0 +1,54 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class HealthBar : MonoBehaviour +{ + public GameObject crystalPrefab; + public Material liveCrystal; + public Material deadCrystal; + + public int lives; + + private int currentHealth; + public int health + { + get{return currentHealth;} + set + { + currentHealth = value; + updateCrystals(); + } + } + + private List<Renderer> crystals = new List<Renderer>(); + + private void updateCrystals() + { + for(int i=0; i<lives; i++) + { + if(health > i) + crystals[i].material = liveCrystal; + else + crystals[i].material = deadCrystal; + } + } + + void Start() + { + for(int i=0; i<lives; i++) + { + GameObject crystal = Instantiate(crystalPrefab, transform.position + Vector3.right*0.5f*i, Quaternion.identity); + crystals.Add(crystal.GetComponentInChildren<Renderer>()); + } + + health = lives; + updateCrystals(); + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs index 7be5b33..58c0ebb 100644 --- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs +++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs @@ -16,10 +16,10 @@ public class ObstacleSpawner : MonoBehaviour { GameObject prefab = null; - if(e.type == EventTimeline.SpawnEventType.alfa) + if(e.type == ObstacleType.alfa) prefab = alfaPrefab; - if(e.type == EventTimeline.SpawnEventType.beta) + if(e.type == ObstacleType.beta) prefab = betaPrefab; var transformT = ((GameObject) Instantiate(prefab, new Vector3(spawnLine, e.height, 0), Quaternion.identity)).transform; diff --git a/nGJ2019/Assets/Scripts/ObstacleType.cs b/nGJ2019/Assets/Scripts/ObstacleType.cs new file mode 100644 index 0000000..c62f629 --- /dev/null +++ b/nGJ2019/Assets/Scripts/ObstacleType.cs @@ -0,0 +1,5 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public enum ObstacleType {alfa, beta} diff --git a/nGJ2019/Assets/Textures/crystal_dead.mat b/nGJ2019/Assets/Textures/crystal_dead.mat new file mode 100644 index 0000000..c849b03 --- /dev/null +++ b/nGJ2019/Assets/Textures/crystal_dead.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: crystal_dead + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/nGJ2019/Assets/Textures/crystal_dead.mat.meta b/nGJ2019/Assets/Textures/crystal_dead.mat.meta new file mode 100644 index 0000000..dbc8f5c --- /dev/null +++ b/nGJ2019/Assets/Textures/crystal_dead.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a772733e42c983144b0a01570895aa30 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/nGJ2019/Assets/Textures/crystal_live.mat b/nGJ2019/Assets/Textures/crystal_live.mat new file mode 100644 index 0000000..588b494 --- /dev/null +++ b/nGJ2019/Assets/Textures/crystal_live.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: crystl + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/nGJ2019/Assets/Textures/crystal_live.mat.meta b/nGJ2019/Assets/Textures/crystal_live.mat.meta new file mode 100644 index 0000000..a14abce --- /dev/null +++ b/nGJ2019/Assets/Textures/crystal_live.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d19c2d3c342b20c46b03be1f5369081d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: |