lots of small changes lol
worked on tambourine level layout, improved tambourine throwing, created enemy respawn system
This commit is contained in:
		@@ -31,9 +31,10 @@ Transform:
 | 
				
			|||||||
  m_LocalPosition: {x: 0, y: 0, z: 0}
 | 
					  m_LocalPosition: {x: 0, y: 0, z: 0}
 | 
				
			||||||
  m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
 | 
					  m_LocalScale: {x: 0.8, y: 0.8, z: 0.8}
 | 
				
			||||||
  m_ConstrainProportionsScale: 1
 | 
					  m_ConstrainProportionsScale: 1
 | 
				
			||||||
  m_Children: []
 | 
					  m_Children:
 | 
				
			||||||
 | 
					  - {fileID: 873928600073109078}
 | 
				
			||||||
  m_Father: {fileID: 0}
 | 
					  m_Father: {fileID: 0}
 | 
				
			||||||
  m_RootOrder: 12
 | 
					  m_RootOrder: 0
 | 
				
			||||||
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 | 
					  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 | 
				
			||||||
--- !u!212 &493245979038171999
 | 
					--- !u!212 &493245979038171999
 | 
				
			||||||
SpriteRenderer:
 | 
					SpriteRenderer:
 | 
				
			||||||
@@ -177,3 +178,80 @@ BoxCollider2D:
 | 
				
			|||||||
  serializedVersion: 2
 | 
					  serializedVersion: 2
 | 
				
			||||||
  m_Size: {x: 1.1846523, y: 1.521285}
 | 
					  m_Size: {x: 1.1846523, y: 1.521285}
 | 
				
			||||||
  m_EdgeRadius: 0
 | 
					  m_EdgeRadius: 0
 | 
				
			||||||
 | 
					--- !u!1 &2874897583829168077
 | 
				
			||||||
 | 
					GameObject:
 | 
				
			||||||
 | 
					  m_ObjectHideFlags: 0
 | 
				
			||||||
 | 
					  m_CorrespondingSourceObject: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabInstance: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
 | 
					  serializedVersion: 6
 | 
				
			||||||
 | 
					  m_Component:
 | 
				
			||||||
 | 
					  - component: {fileID: 873928600073109078}
 | 
				
			||||||
 | 
					  - component: {fileID: 3899809878591694715}
 | 
				
			||||||
 | 
					  m_Layer: 0
 | 
				
			||||||
 | 
					  m_Name: TrumpetBox
 | 
				
			||||||
 | 
					  m_TagString: Trumpet
 | 
				
			||||||
 | 
					  m_Icon: {fileID: 0}
 | 
				
			||||||
 | 
					  m_NavMeshLayer: 0
 | 
				
			||||||
 | 
					  m_StaticEditorFlags: 0
 | 
				
			||||||
 | 
					  m_IsActive: 1
 | 
				
			||||||
 | 
					--- !u!4 &873928600073109078
 | 
				
			||||||
 | 
					Transform:
 | 
				
			||||||
 | 
					  m_ObjectHideFlags: 0
 | 
				
			||||||
 | 
					  m_CorrespondingSourceObject: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabInstance: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
 | 
					  m_GameObject: {fileID: 2874897583829168077}
 | 
				
			||||||
 | 
					  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: 493245979038171992}
 | 
				
			||||||
 | 
					  m_RootOrder: -1
 | 
				
			||||||
 | 
					  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 | 
				
			||||||
 | 
					--- !u!61 &3899809878591694715
 | 
				
			||||||
 | 
					BoxCollider2D:
 | 
				
			||||||
 | 
					  m_ObjectHideFlags: 0
 | 
				
			||||||
 | 
					  m_CorrespondingSourceObject: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabInstance: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
 | 
					  m_GameObject: {fileID: 2874897583829168077}
 | 
				
			||||||
 | 
					  m_Enabled: 1
 | 
				
			||||||
 | 
					  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: 0.058219433, y: 1.1354268}
 | 
				
			||||||
 | 
					  m_SpriteTilingProperty:
 | 
				
			||||||
 | 
					    border: {x: 0, y: 0, z: 0, w: 0}
 | 
				
			||||||
 | 
					    pivot: {x: 0, y: 0}
 | 
				
			||||||
 | 
					    oldSize: {x: 0, y: 0}
 | 
				
			||||||
 | 
					    newSize: {x: 0, y: 0}
 | 
				
			||||||
 | 
					    adaptiveTilingThreshold: 0
 | 
				
			||||||
 | 
					    drawMode: 0
 | 
				
			||||||
 | 
					    adaptiveTiling: 0
 | 
				
			||||||
 | 
					  m_AutoTiling: 0
 | 
				
			||||||
 | 
					  serializedVersion: 2
 | 
				
			||||||
 | 
					  m_Size: {x: 2.125578, y: 2.1344056}
 | 
				
			||||||
 | 
					  m_EdgeRadius: 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -252,9 +252,10 @@ MonoBehaviour:
 | 
				
			|||||||
  m_Name: 
 | 
					  m_Name: 
 | 
				
			||||||
  m_EditorClassIdentifier: 
 | 
					  m_EditorClassIdentifier: 
 | 
				
			||||||
  Data: {fileID: 11400000, guid: fec218a9d55267dedac6ebe31eab6dcd, type: 2}
 | 
					  Data: {fileID: 11400000, guid: fec218a9d55267dedac6ebe31eab6dcd, type: 2}
 | 
				
			||||||
 | 
					  trumpet: 0
 | 
				
			||||||
  in_range: 0
 | 
					  in_range: 0
 | 
				
			||||||
  enemy: {fileID: 0}
 | 
					  enemy: {fileID: 0}
 | 
				
			||||||
  _groundCheckSize: {x: 0.52, y: 0.66}
 | 
					  _groundCheckSize: {x: 0.52, y: 0.81}
 | 
				
			||||||
  _wallCheckSize: {x: 0.8, y: 0.97}
 | 
					  _wallCheckSize: {x: 0.8, y: 0.97}
 | 
				
			||||||
  _groundLayer:
 | 
					  _groundLayer:
 | 
				
			||||||
    serializedVersion: 2
 | 
					    serializedVersion: 2
 | 
				
			||||||
@@ -935,7 +936,7 @@ MonoBehaviour:
 | 
				
			|||||||
  m_Name: 
 | 
					  m_Name: 
 | 
				
			||||||
  m_EditorClassIdentifier: 
 | 
					  m_EditorClassIdentifier: 
 | 
				
			||||||
  tambourine: {fileID: 1383583972917023564, guid: f8f8a87d4db1d45a19b751cae19fe4f6, type: 3}
 | 
					  tambourine: {fileID: 1383583972917023564, guid: f8f8a87d4db1d45a19b751cae19fe4f6, type: 3}
 | 
				
			||||||
  horizSpeed: 7
 | 
					  horizSpeed: 10
 | 
				
			||||||
  vertSpeed: 14
 | 
					  vertSpeed: 14
 | 
				
			||||||
--- !u!1 &5885597208857297553
 | 
					--- !u!1 &5885597208857297553
 | 
				
			||||||
GameObject:
 | 
					GameObject:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3593,9 +3593,9 @@ GameObject:
 | 
				
			|||||||
  - component: {fileID: 1600355032}
 | 
					  - component: {fileID: 1600355032}
 | 
				
			||||||
  - component: {fileID: 1600355031}
 | 
					  - component: {fileID: 1600355031}
 | 
				
			||||||
  - component: {fileID: 1600355030}
 | 
					  - component: {fileID: 1600355030}
 | 
				
			||||||
  m_Layer: 0
 | 
					  m_Layer: 6
 | 
				
			||||||
  m_Name: Swamp
 | 
					  m_Name: Swamp
 | 
				
			||||||
  m_TagString: Untagged
 | 
					  m_TagString: wall
 | 
				
			||||||
  m_Icon: {fileID: 0}
 | 
					  m_Icon: {fileID: 0}
 | 
				
			||||||
  m_NavMeshLayer: 0
 | 
					  m_NavMeshLayer: 0
 | 
				
			||||||
  m_StaticEditorFlags: 0
 | 
					  m_StaticEditorFlags: 0
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -2400,7 +2400,7 @@ MonoBehaviour:
 | 
				
			|||||||
  deathCanvas: {fileID: 0}
 | 
					  deathCanvas: {fileID: 0}
 | 
				
			||||||
  isPaused: 0
 | 
					  isPaused: 0
 | 
				
			||||||
  pauseMenuCanvas: {fileID: 0}
 | 
					  pauseMenuCanvas: {fileID: 0}
 | 
				
			||||||
  inDebugMode: 0
 | 
					  inDebugMode: 1
 | 
				
			||||||
--- !u!114 &2038492347
 | 
					--- !u!114 &2038492347
 | 
				
			||||||
MonoBehaviour:
 | 
					MonoBehaviour:
 | 
				
			||||||
  m_ObjectHideFlags: 0
 | 
					  m_ObjectHideFlags: 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,8 +41,8 @@ public class CameraMovement : MonoBehaviour {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public void FindPlayer() {
 | 
					    public void FindPlayer() {
 | 
				
			||||||
        player = GameObject.FindGameObjectWithTag("Player");
 | 
					        player = GameObject.FindGameObjectWithTag("Player");
 | 
				
			||||||
        if (player == null) {
 | 
					        // if (player == null) {
 | 
				
			||||||
            print("null player!");
 | 
					        //     print("null player!");
 | 
				
			||||||
        }
 | 
					        // }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,6 +68,10 @@ public class EnemyPatrol : MonoBehaviour {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void DefeatEnemy() {
 | 
				
			||||||
 | 
					        this.gameObject.SetActive(false);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void OnDrawGizmos() {
 | 
					    void OnDrawGizmos() {
 | 
				
			||||||
        Gizmos.color = Color.green;
 | 
					        Gizmos.color = Color.green;
 | 
				
			||||||
        if (isHorizontal){
 | 
					        if (isHorizontal){
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -179,7 +179,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
    void OnCollisionEnter2D(Collision2D collision) {
 | 
					    void OnCollisionEnter2D(Collision2D collision) {
 | 
				
			||||||
        if (collision.gameObject.tag == "Enemy") {
 | 
					        if (collision.gameObject.tag == "Enemy") {
 | 
				
			||||||
            if (collision.transform.position.y < transform.position.y) {
 | 
					            if (collision.transform.position.y < transform.position.y) {
 | 
				
			||||||
                Destroy(collision.gameObject);
 | 
					                collision.gameObject.GetComponent<EnemyPatrol>().DefeatEnemy();
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                DestroyPlayer();
 | 
					                DestroyPlayer();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -192,6 +192,13 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public void DestroyPlayer() {
 | 
					    public void DestroyPlayer() {
 | 
				
			||||||
        this.stateController.SetDeathCanvasActive(true);
 | 
					        this.stateController.SetDeathCanvasActive(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // destroy all tambourines
 | 
				
			||||||
 | 
					        GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine");
 | 
				
			||||||
 | 
					        foreach (GameObject tambourine in currentTambourines) {
 | 
				
			||||||
 | 
					            tambourine.GetComponent<TambourineBehavior>().DestroySelf();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Destroy(this.gameObject);
 | 
					        Destroy(this.gameObject);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,14 +97,14 @@ public class PlayerMovement : MonoBehaviour
 | 
				
			|||||||
            CheckDirectionToFace(_moveInput.x > 0);
 | 
					            CheckDirectionToFace(_moveInput.x > 0);
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!IsJumping)
 | 
					        // if (!IsJumping)
 | 
				
			||||||
        {
 | 
					        // {
 | 
				
			||||||
            print("not jumping");
 | 
					        //     print("not jumping");
 | 
				
			||||||
        }
 | 
					        // }
 | 
				
			||||||
        else
 | 
					        // else
 | 
				
			||||||
        {
 | 
					        // {
 | 
				
			||||||
            print("jumping, " + RB.velocity.y);
 | 
					        //     print("jumping, " + RB.velocity.y);
 | 
				
			||||||
        }
 | 
					        // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #region COLLISION CHECKS
 | 
					        #region COLLISION CHECKS
 | 
				
			||||||
        if (!IsJumping)
 | 
					        if (!IsJumping)
 | 
				
			||||||
@@ -164,7 +164,7 @@ public class PlayerMovement : MonoBehaviour
 | 
				
			|||||||
            Jump();
 | 
					            Jump();
 | 
				
			||||||
            if (!IsGrounded() && in_range && trumpet > 0)
 | 
					            if (!IsGrounded() && in_range && trumpet > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Destroy(enemy.gameObject);
 | 
					                enemy.GetComponent<EnemyPatrol>().DefeatEnemy();
 | 
				
			||||||
                enemy = null;
 | 
					                enemy = null;
 | 
				
			||||||
                in_range = false;
 | 
					                in_range = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,9 @@ public class StateController : MonoBehaviour {
 | 
				
			|||||||
    public bool inDebugMode;
 | 
					    public bool inDebugMode;
 | 
				
			||||||
    GameObject debugCanvas;
 | 
					    GameObject debugCanvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Header("Enemies")]
 | 
				
			||||||
 | 
					    GameObject[] enemiesInScene;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void Awake() {
 | 
					    void Awake() {
 | 
				
			||||||
        // check to see if a state controller already exists
 | 
					        // check to see if a state controller already exists
 | 
				
			||||||
        if (GameObject.FindGameObjectWithTag("StateController") != null) {
 | 
					        if (GameObject.FindGameObjectWithTag("StateController") != null) {
 | 
				
			||||||
@@ -50,6 +53,10 @@ public class StateController : MonoBehaviour {
 | 
				
			|||||||
            TogglePauseMenu(false);
 | 
					            TogglePauseMenu(false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // keep track of all enemies
 | 
				
			||||||
 | 
					        enemiesInScene = GameObject.FindGameObjectsWithTag("Enemy");
 | 
				
			||||||
 | 
					        // print(enemiesInScene);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isPaused) {
 | 
					        if (isPaused) {
 | 
				
			||||||
            Unpause();
 | 
					            Unpause();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -87,9 +94,16 @@ public class StateController : MonoBehaviour {
 | 
				
			|||||||
    public void RespawnPlayer() {
 | 
					    public void RespawnPlayer() {
 | 
				
			||||||
        SetDeathCanvasActive(false);
 | 
					        SetDeathCanvasActive(false);
 | 
				
			||||||
        GameObject.Find("Main Camera").GetComponent<CameraMovement>().FindPlayer();
 | 
					        GameObject.Find("Main Camera").GetComponent<CameraMovement>().FindPlayer();
 | 
				
			||||||
 | 
					        RespawnEnemies();
 | 
				
			||||||
        Instantiate(player, spawnPoint.transform.position, player.transform.rotation);
 | 
					        Instantiate(player, spawnPoint.transform.position, player.transform.rotation);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void RespawnEnemies() {
 | 
				
			||||||
 | 
					        foreach (GameObject enemy in enemiesInScene) {
 | 
				
			||||||
 | 
					            enemy.SetActive(true);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void SetDeathCanvasActive(bool activeState) {
 | 
					    public void SetDeathCanvasActive(bool activeState) {
 | 
				
			||||||
        deathCanvas.SetActive(activeState);
 | 
					        deathCanvas.SetActive(activeState);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ public class TambourineBehavior : MonoBehaviour {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    private GameObject collidedObject;
 | 
					    private GameObject collidedObject;
 | 
				
			||||||
    private float timeLerped = 0.0f;
 | 
					    private float timeLerped = 0.0f;
 | 
				
			||||||
    private float timeToLerp = 0.5f;
 | 
					    private float timeToLerp = 0.2f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private GameObject player;
 | 
					    private GameObject player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,7 +52,7 @@ 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") {
 | 
				
			||||||
            collidedObject = col.gameObject;
 | 
					            collidedObject = col.gameObject;
 | 
				
			||||||
            print("Pinning to enemy");
 | 
					            print("Pinning to enemy");
 | 
				
			||||||
@@ -74,7 +74,7 @@ public class TambourineBehavior : MonoBehaviour {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IEnumerator CheckToDestroy() {
 | 
					    IEnumerator CheckToDestroy() {
 | 
				
			||||||
        yield return new WaitForSeconds(5f);
 | 
					        yield return new WaitForSeconds(3f);
 | 
				
			||||||
        // print("waited 5");
 | 
					        // print("waited 5");
 | 
				
			||||||
        if (!player.GetComponent<PlayerBehavior>().grapplingRope.isGrappling) {
 | 
					        if (!player.GetComponent<PlayerBehavior>().grapplingRope.isGrappling) {
 | 
				
			||||||
            DestroySelf();
 | 
					            DestroySelf();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user