fixed tambourine

such a stupid issue omg i can't believe it took me this long to realize what was happening. also added transition music into the caverns
This commit is contained in:
Sam 2023-05-06 17:16:35 -07:00
parent 726ef3d1be
commit a757a47af1
8 changed files with 212 additions and 90 deletions

View File

@ -303,6 +303,17 @@
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
}, },
{
"name": "",
"id": "6654038f-11be-4872-a40a-2e4e1ddb4398",
"path": "<Gamepad>/rightTrigger",
"interactions": "",
"processors": "",
"groups": "",
"action": "Grapple",
"isComposite": false,
"isPartOfComposite": false
},
{ {
"name": "", "name": "",
"id": "f3aa2992-7914-440a-b109-bf84cfa770a3", "id": "f3aa2992-7914-440a-b109-bf84cfa770a3",

View File

@ -1246,7 +1246,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
grapplingGun: {fileID: 3465910379319867675} grapplingGun: {fileID: 3465910379319867675}
m_lineRenderer: {fileID: 5885597207789090694} m_lineRenderer: {fileID: 5885597207789090694}
precision: 40 precision: 20
ropeAnimationCurve: ropeAnimationCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
@ -1341,7 +1341,7 @@ MonoBehaviour:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
ropeProgressionSpeed: 10 ropeProgressionSpeed: 30
isGrappling: 1 isGrappling: 1
sirJacques: {fileID: 7242173371790695690} sirJacques: {fileID: 7242173371790695690}
--- !u!82 &5502596181530623924 --- !u!82 &5502596181530623924

View File

@ -9,13 +9,12 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1383583972917023563} - component: {fileID: 1383583972917023563}
- component: {fileID: 1383583972917023562}
- component: {fileID: 1383583972917023565}
- component: {fileID: 7137590925806210046} - component: {fileID: 7137590925806210046}
- component: {fileID: 4280484977328239622} - component: {fileID: 4280484977328239622}
- component: {fileID: 3514624092989024146} - component: {fileID: 3514624092989024146}
- component: {fileID: -618517480110831953} - component: {fileID: -618517480110831953}
- component: {fileID: 8586493026733961254} - component: {fileID: 8586493026733961254}
- component: {fileID: 4464024349174775543}
m_Layer: 0 m_Layer: 0
m_Name: tambourine m_Name: tambourine
m_TagString: tambourine m_TagString: tambourine
@ -34,83 +33,11 @@ Transform:
m_LocalPosition: {x: -2.98, y: -0.67, z: 0} m_LocalPosition: {x: -2.98, y: -0.67, z: 0}
m_LocalScale: {x: 0.04, y: 0.04, z: 0.04} m_LocalScale: {x: 0.04, y: 0.04, z: 0.04}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 8074438095219817362}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &1383583972917023562
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1383583972917023564}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 3
m_Sprite: {fileID: 21300000, guid: b5f64a07787ea48ad8d00b3ec2d138e4, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 10.2, y: 10.16}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!95 &1383583972917023565
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1383583972917023564}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: c55b775f272db4472814cb6f30ac169e, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!114 &7137590925806210046 --- !u!114 &7137590925806210046
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -315,7 +242,7 @@ BoxCollider2D:
m_IsTrigger: 1 m_IsTrigger: 1
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 25, y: 25} m_Offset: {x: 60, y: 60}
m_SpriteTilingProperty: m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
@ -328,3 +255,159 @@ BoxCollider2D:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 125, y: 125} m_Size: {x: 125, y: 125}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!60 &4464024349174775543
PolygonCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1383583972917023564}
m_Enabled: 0
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -5, y: -2}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 10.2, y: 10.16}
newSize: {x: 10.2, y: 10.16}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Points:
m_Paths:
- - {x: 121, y: -35}
- {x: 87, y: -35}
- {x: 0, y: 0}
- {x: 12, y: 94}
- {x: 121, y: 94}
m_UseDelaunayMesh: 1
--- !u!1 &7218975625062829832
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8074438095219817362}
- component: {fileID: 5289674117813526079}
- component: {fileID: 1153042263548898733}
m_Layer: 0
m_Name: tambourineSprite
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8074438095219817362
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7218975625062829832}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1383583972917023563}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &5289674117813526079
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7218975625062829832}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 3
m_Sprite: {fileID: 21300000, guid: b5f64a07787ea48ad8d00b3ec2d138e4, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 10.2, y: 10.16}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!95 &1153042263548898733
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7218975625062829832}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: c55b775f272db4472814cb6f30ac169e, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 183c10c135b624f7ea121037664d8580
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1170,7 +1170,7 @@ AudioSource:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: e7278b4bebe79784b9977672a9fc8e8a, type: 3} m_audioClip: {fileID: 8300000, guid: 183c10c135b624f7ea121037664d8580, type: 3}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1

View File

@ -8,7 +8,7 @@ public class PlayerBehavior : MonoBehaviour
[Header("Physics:")] [Header("Physics:")]
private float _hInput; private float _hInput;
private Rigidbody2D _rb; private Rigidbody2D _rb;
private int forward = 1; [HideInInspector] public int forward = 1;
public PlayerInput playerInput; public PlayerInput playerInput;
[Header("Tambourine:")] [Header("Tambourine:")]
@ -382,9 +382,16 @@ public class PlayerBehavior : MonoBehaviour
// destroy all tambourines // destroy all tambourines
GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine"); GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine");
foreach (GameObject tambourine in currentTambourines) { print("tambs found: " + currentTambourines.Length);
tambourine.GetComponent<TambourineBehavior>().DestroySelf(); if (currentTambourines != null) {
// Destroy(tambourine); foreach (GameObject tambourine in currentTambourines) {
if (tambourine != null) {
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
print("tamb destroyed");
} else {
print("null tamb");
}
}
} }
StateController.Instance.RespawnPlayer(); StateController.Instance.RespawnPlayer();

View File

@ -24,20 +24,18 @@ public class TambourineBehavior : MonoBehaviour {
void Awake() { void Awake() {
this.gameObject.GetComponent<CircleCollider2D>().enabled = true; this.gameObject.GetComponent<CircleCollider2D>().enabled = true;
rb = this.gameObject.GetComponent<Rigidbody2D>(); rb = this.gameObject.GetComponent<Rigidbody2D>();
animator = this.gameObject.GetComponent<Animator>(); animator = this.gameObject.transform.GetChild(0).gameObject.GetComponent<Animator>();
player = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player");
} }
void Start() { void Start() {
// rb.AddForce(new Vector2(horizSpeed, vertSpeed), ForceMode2D.Impulse); // rb.AddForce(new Vector2(horizSpeed, vertSpeed), ForceMode2D.Impulse);
this.gameObject.transform.localScale = new Vector2(transform.localScale.x * player.GetComponent<PlayerBehavior>().forward, transform.localScale.y);
StartCoroutine(CheckToDestroy()); StartCoroutine(CheckToDestroy());
} }
void Update() { void Update() {
// if (Input.GetKeyUp(KeyCode.K)) {
// Destroy(this.gameObject);
// }
if (player == null) { if (player == null) {
DestroySelf(); DestroySelf();
} else { } else {
@ -46,9 +44,9 @@ public class TambourineBehavior : MonoBehaviour {
// this.gameObject.transform.position = col.transform.position; // this.gameObject.transform.position = col.transform.position;
timeLerped += Time.deltaTime; timeLerped += Time.deltaTime;
this.gameObject.transform.position = Vector2.Lerp(this.gameObject.transform.position, collidedObject.transform.position, timeLerped/timeToLerp); this.gameObject.transform.position = Vector2.Lerp(this.gameObject.transform.position, collidedObject.transform.position, timeLerped/timeToLerp);
if (this.gameObject.transform.position.x == collidedObject.transform.position.x && this.gameObject.transform.position.y == collidedObject.transform.position.y && !pinned) { if (this.gameObject.transform.position.x == collidedObject.transform.position.x && this.gameObject.transform.position.y == collidedObject.transform.position.y && !animator.GetBool("pinned")) {
animator.SetBool("pinned", true);
pinned = true; pinned = true;
animator.SetBool("pinned", true);
tambourineHitSound.Play(); tambourineHitSound.Play();
} else { } else {
// print("pinned, but not same position: " + this.gameObject.transform.position + " / " + collidedObject.transform.position); // print("pinned, but not same position: " + this.gameObject.transform.position + " / " + collidedObject.transform.position);