From 8809d906e34f82f28143b6c5b3204bd6c23e852f Mon Sep 17 00:00:00 2001 From: Claire Peta Date: Thu, 15 Aug 2019 15:14:01 +1000 Subject: [PATCH] Added boulder coroutine to raise and fall 2.0f --- Assets/Prefabs/Traps/CrushingBoulder.prefab | 14 ++-- Assets/Prefabs/Traps/InGroundTrap.prefab | 70 +++++++++---------- .../SinglePlayer Levels/TuteLevelOne.unity | 4 +- Assets/Scenes/Trap Creation - Claire.unity | 4 +- Assets/Scripts/Traps/CannonShot.cs | 1 - Assets/Scripts/Traps/CrushingBoulder.cs | 41 ++++++++++- 6 files changed, 87 insertions(+), 47 deletions(-) diff --git a/Assets/Prefabs/Traps/CrushingBoulder.prefab b/Assets/Prefabs/Traps/CrushingBoulder.prefab index d455c54..8c0a3be 100644 --- a/Assets/Prefabs/Traps/CrushingBoulder.prefab +++ b/Assets/Prefabs/Traps/CrushingBoulder.prefab @@ -252,6 +252,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 87ae70f1ec0c67743923bd4a83ee85d8, type: 3} m_Name: m_EditorClassIdentifier: + triggeranimate: 0 + triggeranimate1: 0 --- !u!1001 &6745622316608603784 PrefabInstance: m_ObjectHideFlags: 0 @@ -259,10 +261,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 6745622317302131140} m_Modifications: - - target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3} - propertyPath: m_Name - value: Rock_2 (2) - objectReference: {fileID: 0} - target: {fileID: 4614242176542224, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -315,6 +313,14 @@ PrefabInstance: propertyPath: m_LocalScale.z value: 1.2289 objectReference: {fileID: 0} + - target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3} + propertyPath: m_Name + value: Rock_2 (2) + objectReference: {fileID: 0} + - target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3} --- !u!4 &6741087515541790872 stripped diff --git a/Assets/Prefabs/Traps/InGroundTrap.prefab b/Assets/Prefabs/Traps/InGroundTrap.prefab index 6758fb6..a22ad49 100644 --- a/Assets/Prefabs/Traps/InGroundTrap.prefab +++ b/Assets/Prefabs/Traps/InGroundTrap.prefab @@ -59,17 +59,13 @@ PrefabInstance: propertyPath: m_Name value: Cube_Pit objectReference: {fileID: 0} - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} propertyPath: m_LocalPosition.y - value: -1 + value: -0.84 objectReference: {fileID: 0} - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} propertyPath: m_LocalPosition.z @@ -132,10 +128,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3280778023726093299} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (4) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -180,6 +172,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 180 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (4) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!1001 &3281312546064687605 @@ -189,10 +185,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3281312547625224782} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (3) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -241,6 +233,10 @@ PrefabInstance: propertyPath: m_LocalScale.x value: 0.9 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (3) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!4 &3280778022459986741 stripped @@ -256,10 +252,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3280778023471378434} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (4) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -304,6 +296,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 180 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (4) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!1001 &3281312547073059897 @@ -313,10 +309,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3280778023765625369} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (4) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -361,6 +353,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 180 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (4) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!1001 &3281312547210150594 @@ -370,10 +366,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3281312547625224782} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (4) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: -0.4 @@ -422,6 +414,10 @@ PrefabInstance: propertyPath: m_LocalScale.x value: 0.90000045 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (4) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!4 &3280778023471378434 stripped @@ -437,10 +433,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3280778022459986741} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (4) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -485,6 +477,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 180 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (4) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!1001 &3281312547451467993 @@ -494,10 +490,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3281312547625224782} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (1) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -546,6 +538,10 @@ PrefabInstance: propertyPath: m_LocalScale.x value: 0.9 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (1) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!4 &3280778023765625369 stripped @@ -561,10 +557,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 3281312547625224782} m_Modifications: - - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} - propertyPath: m_Name - value: FanceWooden2 (2) - objectReference: {fileID: 0} - target: {fileID: 4004810153341632, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} propertyPath: m_LocalPosition.x value: 0.4 @@ -613,6 +605,10 @@ PrefabInstance: propertyPath: m_LocalScale.x value: 0.90000045 objectReference: {fileID: 0} + - target: {fileID: 1989401929107402, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} + propertyPath: m_Name + value: FanceWooden2 (2) + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0247930279caa4341ab23ddd2d4b69f8, type: 3} --- !u!4 &3280778023726093299 stripped diff --git a/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity b/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity index 43e9da9..4aea42e 100644 --- a/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity +++ b/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55c97cc550b62aea593f673fa33abf5f25e2cb288615a18a516d1ededae3b400 -size 188516 +oid sha256:9a0370235c2e3d814b13101554c409f0f7e5112f16a322de816c6f10e9386a82 +size 201860 diff --git a/Assets/Scenes/Trap Creation - Claire.unity b/Assets/Scenes/Trap Creation - Claire.unity index 3a34268..91dea02 100644 --- a/Assets/Scenes/Trap Creation - Claire.unity +++ b/Assets/Scenes/Trap Creation - Claire.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:80df00e537192d540e13c331dab9d71395b5c35ff337d240795774117fb0478f -size 23536 +oid sha256:0239b1fa6e3e86182708fee4ebf8a4cc625d1d2e4815d5cdd34ff2395778a336 +size 27072 diff --git a/Assets/Scripts/Traps/CannonShot.cs b/Assets/Scripts/Traps/CannonShot.cs index 0c1f70e..126eae3 100644 --- a/Assets/Scripts/Traps/CannonShot.cs +++ b/Assets/Scripts/Traps/CannonShot.cs @@ -56,7 +56,6 @@ public class CannonShot : MonoBehaviour Destroy(gameObject); } - void OnTriggerEnter(Collider other) { foreach (string name in Names) diff --git a/Assets/Scripts/Traps/CrushingBoulder.cs b/Assets/Scripts/Traps/CrushingBoulder.cs index a9895f6..72a2916 100644 --- a/Assets/Scripts/Traps/CrushingBoulder.cs +++ b/Assets/Scripts/Traps/CrushingBoulder.cs @@ -4,8 +4,47 @@ using UnityEngine; public class CrushingBoulder : MonoBehaviour { + + public bool triggeranimate; + public bool triggeranimate1; + + private void Update() + { + //for testing purposes + if (triggeranimate == true) + { + Animate(); + triggeranimate = false; + } + //for testing purposes + if (triggeranimate1 == true) + { + returnToPosition(); + triggeranimate1 = false; + } + } + + IEnumerator FallRaiseCoroutine(float dropDistance) + { + float elapsedTime = 0; + Vector3 startPosition = transform.position; + Vector3 endPosition = new Vector3(transform.position.x, transform.position.y + dropDistance, transform.position.z); + float time = 0.8f; + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + transform.position = endPosition; + } + public void Animate() { - Debug.Log("abs"); + StartCoroutine(FallRaiseCoroutine(-2.0f)); + } + public void returnToPosition() + { + StartCoroutine(FallRaiseCoroutine(2.0f)); } }