bugfixed tambourine and player death

death still needs work!
This commit is contained in:
Sam 2023-04-30 14:16:29 -07:00
parent 9f36564e67
commit c51af3ce92
6 changed files with 27 additions and 22 deletions

View File

@ -22,38 +22,38 @@ AnimationClip:
curve:
- time: 0
value: {fileID: -122338556, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.083333336
- time: 0.041666668
value: {fileID: 189834051, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.16666667
- time: 0.083333336
value: {fileID: -2024555392, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.25
- time: 0.125
value: {fileID: 1086045528, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.33333334
- time: 0.16666667
value: {fileID: 884718321, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.41666666
- time: 0.20833333
value: {fileID: -460163578, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.5
- time: 0.25
value: {fileID: -990243943, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.5833333
- time: 0.29166666
value: {fileID: -625216433, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.6666667
- time: 0.33333334
value: {fileID: 323212427, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.75
- time: 0.375
value: {fileID: 565888814, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.8333333
- time: 0.41666666
value: {fileID: 315249131, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 0.9166667
- time: 0.45833334
value: {fileID: -318639155, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 1
- time: 0.5
value: {fileID: 478881412, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
- time: 1.0833334
- time: 0.5416667
value: {fileID: 1253964676, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
flags: 2
m_SampleRate: 12
m_SampleRate: 24
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
@ -89,7 +89,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1.1666667
m_StopTime: 0.5833334
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0

View File

@ -2383,7 +2383,7 @@ Camera:
far clip plane: 1000
field of view: 34
orthographic: 1
orthographic size: 6
orthographic size: 9
m_Depth: -1
m_CullingMask:
serializedVersion: 2
@ -2407,7 +2407,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -33.22, y: 24.3, z: -10}
m_LocalPosition: {x: -33.22, y: 20.8, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -2430,6 +2430,7 @@ MonoBehaviour:
xOffset: 3
yOffset: 1
smoothing: 6
size: 9
xLocked: 0
yLocked: 0
--- !u!1001 &525785197
@ -6385,7 +6386,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_LocalPosition.y
value: 23.3
value: 19.8
objectReference: {fileID: 0}
- target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_LocalPosition.z

View File

@ -11,6 +11,9 @@ public class CameraMovement : MonoBehaviour {
[SerializeField] float yOffset;
[SerializeField] float smoothing;
[Header("Positioning")]
[SerializeField] float size;
[Header("Locking")]
[SerializeField] bool xLocked;
[SerializeField] bool yLocked;
@ -18,6 +21,7 @@ public class CameraMovement : MonoBehaviour {
void Awake() {
FindPlayer();
this.gameObject.GetComponent<Camera>().orthographicSize = size;
}
// Update is called once per frame

View File

@ -182,7 +182,7 @@ public class PlayerBehavior : MonoBehaviour
}
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.tag == "Enemy") {
if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "ProjectileEnemy") {
if (collision.transform.position.y < transform.position.y) {
_rb.AddForce(Vector2.up * 8, ForceMode2D.Impulse);
collision.gameObject.GetComponent<EnemyPatrol>().DefeatEnemy();
@ -210,8 +210,5 @@ public class PlayerBehavior : MonoBehaviour
foreach (GameObject tambourine in currentTambourines) {
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
}
yield return new WaitForSeconds(2f);
Destroy(this.gameObject);
}
}

View File

@ -102,6 +102,7 @@ public class StateController : MonoBehaviour {
}
public void RespawnPlayer() {
Destroy(GameObject.FindGameObjectWithTag("Player"));
SetDeathCanvasActive(false);
GameObject.Find("Main Camera").GetComponent<CameraMovement>().FindPlayer();
RespawnEnemies();

View File

@ -54,12 +54,14 @@ public class TambourineBehavior : MonoBehaviour {
void OnTriggerEnter2D(Collider2D col) {
// print(col.tag);
if (col.tag == "Enemy") {
this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
collidedObject = col.gameObject;
print("Pinning to enemy");
this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
collidedObject.GetComponent<EnemyPatrol>().pinned = true;
collidedObject.GetComponent<EnemyPatrol>().TogglePin(true);
} else if (col.tag == "Projectile") {
this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
collidedObject = col.gameObject;
print("pinned to projectile");
this.gameObject.GetComponent<CircleCollider2D>().enabled = false;