player can now jump on enemies to defeat them
This commit is contained in:
		@@ -193,7 +193,7 @@ BoxCollider2D:
 | 
			
		||||
    adaptiveTiling: 0
 | 
			
		||||
  m_AutoTiling: 0
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  m_Size: {x: 1, y: 1}
 | 
			
		||||
  m_Size: {x: 5.5, y: 5.5}
 | 
			
		||||
  m_EdgeRadius: 0
 | 
			
		||||
--- !u!114 &217851877528699149
 | 
			
		||||
MonoBehaviour:
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ Transform:
 | 
			
		||||
  m_ConstrainProportionsScale: 1
 | 
			
		||||
  m_Children: []
 | 
			
		||||
  m_Father: {fileID: 0}
 | 
			
		||||
  m_RootOrder: 14
 | 
			
		||||
  m_RootOrder: 0
 | 
			
		||||
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 | 
			
		||||
--- !u!212 &493245979038171999
 | 
			
		||||
SpriteRenderer:
 | 
			
		||||
 
 | 
			
		||||
@@ -2042,6 +2042,79 @@ RectTransform:
 | 
			
		||||
  m_AnchoredPosition: {x: 0, y: 0}
 | 
			
		||||
  m_SizeDelta: {x: 0, y: 0}
 | 
			
		||||
  m_Pivot: {x: 0, y: 0}
 | 
			
		||||
--- !u!1001 &1044872105
 | 
			
		||||
PrefabInstance:
 | 
			
		||||
  m_ObjectHideFlags: 0
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  m_Modification:
 | 
			
		||||
    serializedVersion: 3
 | 
			
		||||
    m_TransformParent: {fileID: 0}
 | 
			
		||||
    m_Modifications:
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_RootOrder
 | 
			
		||||
      value: 18
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalScale.x
 | 
			
		||||
      value: 0.4967
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalScale.y
 | 
			
		||||
      value: 0.4967
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalScale.z
 | 
			
		||||
      value: 0.4967
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalPosition.x
 | 
			
		||||
      value: -31.1516
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalPosition.y
 | 
			
		||||
      value: -10.7202
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalPosition.z
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalRotation.w
 | 
			
		||||
      value: 1
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalRotation.x
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalRotation.y
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalRotation.z
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalEulerAnglesHint.x
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalEulerAnglesHint.y
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171992, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_LocalEulerAnglesHint.z
 | 
			
		||||
      value: 0
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 493245979038171997, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
      propertyPath: m_Name
 | 
			
		||||
      value: Snake (1)
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    m_RemovedComponents: []
 | 
			
		||||
    m_RemovedGameObjects: []
 | 
			
		||||
    m_AddedGameObjects: []
 | 
			
		||||
    m_AddedComponents: []
 | 
			
		||||
  m_SourcePrefab: {fileID: 100100000, guid: d175e4c5882b2464ab0425220d00a671, type: 3}
 | 
			
		||||
--- !u!1 &1061595775
 | 
			
		||||
GameObject:
 | 
			
		||||
  m_ObjectHideFlags: 0
 | 
			
		||||
 
 | 
			
		||||
@@ -150,8 +150,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        }
 | 
			
		||||
        else if (col.tag == "instaDeath")
 | 
			
		||||
        {
 | 
			
		||||
            this.stateController.SetDeathCanvasActive(true);
 | 
			
		||||
            Destroy(this.gameObject);
 | 
			
		||||
            DestroyPlayer();
 | 
			
		||||
        }
 | 
			
		||||
        else if (col.tag == "spawnPoint") {
 | 
			
		||||
            stateController.spawnPoint.GetComponent<SpawnPointBehavior>().DeactivateSpawnPoint();
 | 
			
		||||
@@ -169,8 +168,20 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    void OnCollisionEnter2D(Collision2D collision) {
 | 
			
		||||
        if (collision.gameObject.tag == "Enemy") {
 | 
			
		||||
            this.stateController.SetDeathCanvasActive(true);
 | 
			
		||||
            Destroy(this.gameObject);
 | 
			
		||||
            if (collision.transform.position.y < transform.position.y) {
 | 
			
		||||
                Destroy(collision.gameObject);
 | 
			
		||||
            } else {
 | 
			
		||||
                DestroyPlayer();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if (collision.gameObject.tag == "Projectile") {
 | 
			
		||||
            Destroy(collision.gameObject);
 | 
			
		||||
            DestroyPlayer();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void DestroyPlayer() {
 | 
			
		||||
        this.stateController.SetDeathCanvasActive(true);
 | 
			
		||||
        Destroy(this.gameObject);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user