spikes are fatal

master
Jordan Orelli 5 years ago
parent 14b75f47c0
commit 7a7a39d500

@ -45,7 +45,7 @@ GameObject:
- component: {fileID: 4393206124236303816} - component: {fileID: 4393206124236303816}
m_Layer: 11 m_Layer: 11
m_Name: spike m_Name: spike
m_TagString: Untagged m_TagString: Fatal
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

@ -11,7 +11,9 @@ public class CameraController : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void Update() { void Update() {
if (player) {
transform.position = new Vector3(player.position.x-4, player.position.y+4, player.position.z-8); transform.position = new Vector3(player.position.x-4, player.position.y+4, player.position.z-8);
transform.LookAt(player); transform.LookAt(player);
} }
} }
}

@ -55,7 +55,11 @@ public class MoveController : MonoBehaviour
hit = hits[h]; hit = hits[h];
} }
} }
// hit.collider.gameObject
if (hit.collider.gameObject.CompareTag("Fatal")) {
Destroy(gameObject);
return;
}
float slopeAngle = Vector3.Angle(hit.normal, Vector3.up); float slopeAngle = Vector3.Angle(hit.normal, Vector3.up);
if (i == 0 && slopeAngle <= maxClimbAngle) { if (i == 0 && slopeAngle <= maxClimbAngle) {
@ -107,6 +111,11 @@ public class MoveController : MonoBehaviour
} }
} }
if (hit.collider.gameObject.CompareTag("Fatal")) {
Destroy(gameObject);
return;
}
velocity.y = (hit.distance - skinWidth) * directionY; velocity.y = (hit.distance - skinWidth) * directionY;
// Debug.LogFormat("with RayLength {0} MinHitDist {1} setting velocity.y to {2}", rayLength, hit.distance, velocity.y); // Debug.LogFormat("with RayLength {0} MinHitDist {1} setting velocity.y to {2}", rayLength, hit.distance, velocity.y);
rayLength = hit.distance; rayLength = hit.distance;

@ -3,7 +3,8 @@
--- !u!78 &1 --- !u!78 &1
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: [] tags:
- Fatal
layers: layers:
- Default - Default
- TransparentFX - TransparentFX

Loading…
Cancel
Save