bugfixed tambourine and player death
death still needs work!
This commit is contained in:
		@@ -22,38 +22,38 @@ AnimationClip:
 | 
				
			|||||||
    curve:
 | 
					    curve:
 | 
				
			||||||
    - time: 0
 | 
					    - time: 0
 | 
				
			||||||
      value: {fileID: -122338556, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: -122338556, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.083333336
 | 
					    - time: 0.041666668
 | 
				
			||||||
      value: {fileID: 189834051, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 189834051, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.16666667
 | 
					    - time: 0.083333336
 | 
				
			||||||
      value: {fileID: -2024555392, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: -2024555392, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.25
 | 
					    - time: 0.125
 | 
				
			||||||
      value: {fileID: 1086045528, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 1086045528, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.33333334
 | 
					    - time: 0.16666667
 | 
				
			||||||
      value: {fileID: 884718321, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 884718321, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.41666666
 | 
					    - time: 0.20833333
 | 
				
			||||||
      value: {fileID: -460163578, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: -460163578, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.5
 | 
					    - time: 0.25
 | 
				
			||||||
      value: {fileID: -990243943, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: -990243943, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.5833333
 | 
					    - time: 0.29166666
 | 
				
			||||||
      value: {fileID: -625216433, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: -625216433, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.6666667
 | 
					    - time: 0.33333334
 | 
				
			||||||
      value: {fileID: 323212427, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 323212427, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.75
 | 
					    - time: 0.375
 | 
				
			||||||
      value: {fileID: 565888814, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 565888814, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.8333333
 | 
					    - time: 0.41666666
 | 
				
			||||||
      value: {fileID: 315249131, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 315249131, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 0.9166667
 | 
					    - time: 0.45833334
 | 
				
			||||||
      value: {fileID: -318639155, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: -318639155, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 1
 | 
					    - time: 0.5
 | 
				
			||||||
      value: {fileID: 478881412, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 478881412, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    - time: 1.0833334
 | 
					    - time: 0.5416667
 | 
				
			||||||
      value: {fileID: 1253964676, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
					      value: {fileID: 1253964676, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3}
 | 
				
			||||||
    attribute: m_Sprite
 | 
					    attribute: m_Sprite
 | 
				
			||||||
    path: 
 | 
					    path: 
 | 
				
			||||||
    classID: 212
 | 
					    classID: 212
 | 
				
			||||||
    script: {fileID: 0}
 | 
					    script: {fileID: 0}
 | 
				
			||||||
    flags: 2
 | 
					    flags: 2
 | 
				
			||||||
  m_SampleRate: 12
 | 
					  m_SampleRate: 24
 | 
				
			||||||
  m_WrapMode: 0
 | 
					  m_WrapMode: 0
 | 
				
			||||||
  m_Bounds:
 | 
					  m_Bounds:
 | 
				
			||||||
    m_Center: {x: 0, y: 0, z: 0}
 | 
					    m_Center: {x: 0, y: 0, z: 0}
 | 
				
			||||||
@@ -89,7 +89,7 @@ AnimationClip:
 | 
				
			|||||||
    m_AdditiveReferencePoseClip: {fileID: 0}
 | 
					    m_AdditiveReferencePoseClip: {fileID: 0}
 | 
				
			||||||
    m_AdditiveReferencePoseTime: 0
 | 
					    m_AdditiveReferencePoseTime: 0
 | 
				
			||||||
    m_StartTime: 0
 | 
					    m_StartTime: 0
 | 
				
			||||||
    m_StopTime: 1.1666667
 | 
					    m_StopTime: 0.5833334
 | 
				
			||||||
    m_OrientationOffsetY: 0
 | 
					    m_OrientationOffsetY: 0
 | 
				
			||||||
    m_Level: 0
 | 
					    m_Level: 0
 | 
				
			||||||
    m_CycleOffset: 0
 | 
					    m_CycleOffset: 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2383,7 +2383,7 @@ Camera:
 | 
				
			|||||||
  far clip plane: 1000
 | 
					  far clip plane: 1000
 | 
				
			||||||
  field of view: 34
 | 
					  field of view: 34
 | 
				
			||||||
  orthographic: 1
 | 
					  orthographic: 1
 | 
				
			||||||
  orthographic size: 6
 | 
					  orthographic size: 9
 | 
				
			||||||
  m_Depth: -1
 | 
					  m_Depth: -1
 | 
				
			||||||
  m_CullingMask:
 | 
					  m_CullingMask:
 | 
				
			||||||
    serializedVersion: 2
 | 
					    serializedVersion: 2
 | 
				
			||||||
@@ -2407,7 +2407,7 @@ Transform:
 | 
				
			|||||||
  m_PrefabAsset: {fileID: 0}
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
  m_GameObject: {fileID: 519420028}
 | 
					  m_GameObject: {fileID: 519420028}
 | 
				
			||||||
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
 | 
					  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_LocalScale: {x: 1, y: 1, z: 1}
 | 
				
			||||||
  m_ConstrainProportionsScale: 0
 | 
					  m_ConstrainProportionsScale: 0
 | 
				
			||||||
  m_Children: []
 | 
					  m_Children: []
 | 
				
			||||||
@@ -2430,6 +2430,7 @@ MonoBehaviour:
 | 
				
			|||||||
  xOffset: 3
 | 
					  xOffset: 3
 | 
				
			||||||
  yOffset: 1
 | 
					  yOffset: 1
 | 
				
			||||||
  smoothing: 6
 | 
					  smoothing: 6
 | 
				
			||||||
 | 
					  size: 9
 | 
				
			||||||
  xLocked: 0
 | 
					  xLocked: 0
 | 
				
			||||||
  yLocked: 0
 | 
					  yLocked: 0
 | 
				
			||||||
--- !u!1001 &525785197
 | 
					--- !u!1001 &525785197
 | 
				
			||||||
@@ -6385,7 +6386,7 @@ PrefabInstance:
 | 
				
			|||||||
      objectReference: {fileID: 0}
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
    - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
					    - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
				
			||||||
      propertyPath: m_LocalPosition.y
 | 
					      propertyPath: m_LocalPosition.y
 | 
				
			||||||
      value: 23.3
 | 
					      value: 19.8
 | 
				
			||||||
      objectReference: {fileID: 0}
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
    - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
					    - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
				
			||||||
      propertyPath: m_LocalPosition.z
 | 
					      propertyPath: m_LocalPosition.z
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,9 @@ public class CameraMovement : MonoBehaviour {
 | 
				
			|||||||
    [SerializeField] float yOffset;
 | 
					    [SerializeField] float yOffset;
 | 
				
			||||||
    [SerializeField] float smoothing;
 | 
					    [SerializeField] float smoothing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Header("Positioning")]
 | 
				
			||||||
 | 
					    [SerializeField] float size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Header("Locking")]
 | 
					    [Header("Locking")]
 | 
				
			||||||
    [SerializeField] bool xLocked;
 | 
					    [SerializeField] bool xLocked;
 | 
				
			||||||
    [SerializeField] bool yLocked;
 | 
					    [SerializeField] bool yLocked;
 | 
				
			||||||
@@ -18,6 +21,7 @@ public class CameraMovement : MonoBehaviour {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    void Awake() {
 | 
					    void Awake() {
 | 
				
			||||||
        FindPlayer();
 | 
					        FindPlayer();
 | 
				
			||||||
 | 
					        this.gameObject.GetComponent<Camera>().orthographicSize = size;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Update is called once per frame
 | 
					    // Update is called once per frame
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -182,7 +182,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void OnCollisionEnter2D(Collision2D collision) {
 | 
					    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) {
 | 
					            if (collision.transform.position.y < transform.position.y) {
 | 
				
			||||||
                _rb.AddForce(Vector2.up * 8, ForceMode2D.Impulse);
 | 
					                _rb.AddForce(Vector2.up * 8, ForceMode2D.Impulse);
 | 
				
			||||||
                collision.gameObject.GetComponent<EnemyPatrol>().DefeatEnemy();
 | 
					                collision.gameObject.GetComponent<EnemyPatrol>().DefeatEnemy();
 | 
				
			||||||
@@ -210,8 +210,5 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
        foreach (GameObject tambourine in currentTambourines) {
 | 
					        foreach (GameObject tambourine in currentTambourines) {
 | 
				
			||||||
            tambourine.GetComponent<TambourineBehavior>().DestroySelf();
 | 
					            tambourine.GetComponent<TambourineBehavior>().DestroySelf();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        yield return new WaitForSeconds(2f);
 | 
					 | 
				
			||||||
        Destroy(this.gameObject);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,6 +102,7 @@ public class StateController : MonoBehaviour {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void RespawnPlayer() {
 | 
					    public void RespawnPlayer() {
 | 
				
			||||||
 | 
					        Destroy(GameObject.FindGameObjectWithTag("Player"));
 | 
				
			||||||
        SetDeathCanvasActive(false);
 | 
					        SetDeathCanvasActive(false);
 | 
				
			||||||
        GameObject.Find("Main Camera").GetComponent<CameraMovement>().FindPlayer();
 | 
					        GameObject.Find("Main Camera").GetComponent<CameraMovement>().FindPlayer();
 | 
				
			||||||
        RespawnEnemies();
 | 
					        RespawnEnemies();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,12 +54,14 @@ public class TambourineBehavior : MonoBehaviour {
 | 
				
			|||||||
    void OnTriggerEnter2D(Collider2D col) {
 | 
					    void OnTriggerEnter2D(Collider2D col) {
 | 
				
			||||||
        // print(col.tag);
 | 
					        // print(col.tag);
 | 
				
			||||||
        if (col.tag == "Enemy") {
 | 
					        if (col.tag == "Enemy") {
 | 
				
			||||||
 | 
					            this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
 | 
				
			||||||
            collidedObject = col.gameObject;
 | 
					            collidedObject = col.gameObject;
 | 
				
			||||||
            print("Pinning to enemy");
 | 
					            print("Pinning to enemy");
 | 
				
			||||||
            this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
 | 
					            this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
 | 
				
			||||||
            collidedObject.GetComponent<EnemyPatrol>().pinned = true;
 | 
					            collidedObject.GetComponent<EnemyPatrol>().pinned = true;
 | 
				
			||||||
            collidedObject.GetComponent<EnemyPatrol>().TogglePin(true);
 | 
					            collidedObject.GetComponent<EnemyPatrol>().TogglePin(true);
 | 
				
			||||||
        } else if (col.tag == "Projectile") {
 | 
					        } else if (col.tag == "Projectile") {
 | 
				
			||||||
 | 
					            this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
 | 
				
			||||||
            collidedObject = col.gameObject;
 | 
					            collidedObject = col.gameObject;
 | 
				
			||||||
            print("pinned to projectile");
 | 
					            print("pinned to projectile");
 | 
				
			||||||
            this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
 | 
					            this.gameObject.GetComponent<CircleCollider2D>().enabled = false;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user