reconfigured collision
also made some adjustments to player behavior and controller
This commit is contained in:
parent
fb8732f820
commit
275763628b
BIN
Assets/.DS_Store
vendored
BIN
Assets/.DS_Store
vendored
Binary file not shown.
@ -21,7 +21,7 @@
|
|||||||
"expectedControlType": "Button",
|
"expectedControlType": "Button",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"initialStateCheck": false
|
"initialStateCheck": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ThrowTambourine",
|
"name": "ThrowTambourine",
|
||||||
|
@ -13,9 +13,9 @@ GameObject:
|
|||||||
- component: {fileID: 5885597207104481988}
|
- component: {fileID: 5885597207104481988}
|
||||||
- component: {fileID: 5885597207104481989}
|
- component: {fileID: 5885597207104481989}
|
||||||
- component: {fileID: 5885597207104481990}
|
- component: {fileID: 5885597207104481990}
|
||||||
- component: {fileID: 2233892752547184614}
|
|
||||||
- component: {fileID: 5885597207104481984}
|
- component: {fileID: 5885597207104481984}
|
||||||
- component: {fileID: 1407172087}
|
- component: {fileID: 1407172087}
|
||||||
|
- component: {fileID: 5559747613460074786}
|
||||||
m_Layer: 2
|
m_Layer: 2
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Player
|
m_TagString: Player
|
||||||
@ -80,7 +80,7 @@ SpriteRenderer:
|
|||||||
m_LightmapParameters: {fileID: 0}
|
m_LightmapParameters: {fileID: 0}
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 1
|
||||||
m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
|
m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
@ -106,7 +106,7 @@ Rigidbody2D:
|
|||||||
m_UseAutoMass: 0
|
m_UseAutoMass: 0
|
||||||
m_Mass: 1
|
m_Mass: 1
|
||||||
m_LinearDrag: 0
|
m_LinearDrag: 0
|
||||||
m_AngularDrag: 0.05
|
m_AngularDrag: 0
|
||||||
m_GravityScale: 1
|
m_GravityScale: 1
|
||||||
m_Material: {fileID: 6200000, guid: 83749aa79f3034041ac7616c39c77dfb, type: 2}
|
m_Material: {fileID: 6200000, guid: 83749aa79f3034041ac7616c39c77dfb, type: 2}
|
||||||
m_IncludeLayers:
|
m_IncludeLayers:
|
||||||
@ -117,7 +117,7 @@ Rigidbody2D:
|
|||||||
m_Bits: 0
|
m_Bits: 0
|
||||||
m_Interpolate: 0
|
m_Interpolate: 0
|
||||||
m_SleepingMode: 1
|
m_SleepingMode: 1
|
||||||
m_CollisionDetection: 0
|
m_CollisionDetection: 1
|
||||||
m_Constraints: 4
|
m_Constraints: 4
|
||||||
--- !u!231 &5885597207104481989
|
--- !u!231 &5885597207104481989
|
||||||
SpringJoint2D:
|
SpringJoint2D:
|
||||||
@ -175,31 +175,6 @@ CircleCollider2D:
|
|||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Radius: 0.5
|
m_Radius: 0.5
|
||||||
--- !u!114 &2233892752547184614
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5885597207104481991}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: b0115312556794123a3cafad4b83d0a7, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
moveSpeed: 15
|
|
||||||
jumpSpeed: 5
|
|
||||||
airSpeed: 0
|
|
||||||
playerInput: {fileID: 1407172087}
|
|
||||||
groundLayer:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 64
|
|
||||||
boxSize: {x: 0.03, y: 0.21}
|
|
||||||
maxDistanceFromGround: 0.13
|
|
||||||
launcher: {fileID: 6559806128767475056}
|
|
||||||
hasTambourine: 1
|
|
||||||
grapplingGun: {fileID: 3465910379319867675}
|
|
||||||
grapplingRope: {fileID: 7648135587659148198}
|
|
||||||
--- !u!232 &5885597207104481984
|
--- !u!232 &5885597207104481984
|
||||||
DistanceJoint2D:
|
DistanceJoint2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -250,6 +225,31 @@ MonoBehaviour:
|
|||||||
m_DefaultActionMap: Player
|
m_DefaultActionMap: Player
|
||||||
m_SplitScreenIndex: -1
|
m_SplitScreenIndex: -1
|
||||||
m_Camera: {fileID: 0}
|
m_Camera: {fileID: 0}
|
||||||
|
--- !u!114 &5559747613460074786
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5885597207104481991}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7b873819f9a3f36ef898a0403972da28, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
maxRunSpeed: 20
|
||||||
|
runAcceleration: 20
|
||||||
|
snappiness: 2.5
|
||||||
|
jumpSpeed: 5
|
||||||
|
airSpeedMultiplier: 0.5
|
||||||
|
groundLayer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 64
|
||||||
|
boxSize: {x: 0.03, y: 0.21}
|
||||||
|
maxDistanceFromGround: 0.13
|
||||||
|
grapplingGun: {fileID: 3465910379319867675}
|
||||||
|
grapplingRope: {fileID: 7648135587659148198}
|
||||||
|
stateController: {fileID: 0}
|
||||||
--- !u!1 &5885597207531562995
|
--- !u!1 &5885597207531562995
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ public class Launch : MonoBehaviour {
|
|||||||
[SerializeField] private float horizSpeed;
|
[SerializeField] private float horizSpeed;
|
||||||
[SerializeField] private float vertSpeed;
|
[SerializeField] private float vertSpeed;
|
||||||
|
|
||||||
public void ThrowTambourine(int facing) {
|
public void ThrowTambourine(float facing) {
|
||||||
GameObject newTambourine = Instantiate(tambourine, this.gameObject.transform.position, this.gameObject.transform.rotation);
|
GameObject newTambourine = Instantiate(tambourine, this.gameObject.transform.position, this.gameObject.transform.rotation);
|
||||||
// multiply horizSpeed by facing if not using moving launch point
|
// multiply horizSpeed by facing if not using moving launch point
|
||||||
newTambourine.GetComponent<Rigidbody2D>().AddForce(new Vector2(horizSpeed * facing, vertSpeed), ForceMode2D.Impulse);
|
newTambourine.GetComponent<Rigidbody2D>().AddForce(new Vector2(horizSpeed * facing, vertSpeed), ForceMode2D.Impulse);
|
||||||
|
@ -22,14 +22,16 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
[Header("Tambourine:")]
|
[Header("Tambourine:")]
|
||||||
[SerializeField] private Launch launcher;
|
[SerializeField] private Launch launcher;
|
||||||
[HideInInspector] public bool hasTambourine = true;
|
[HideInInspector] public bool hasTambourine = true;
|
||||||
|
GameObject tambourine;
|
||||||
|
|
||||||
[Header("Grappling:")]
|
[Header("Grappling:")]
|
||||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||||
[SerializeField] public Tutorial_GrapplingRope grapplingRope;
|
[SerializeField] public Tutorial_GrapplingRope grapplingRope;
|
||||||
private GameObject grappleSurface;
|
private GameObject grappleSurface;
|
||||||
|
|
||||||
[Header("State Control:")]
|
[Header("Controllers:")]
|
||||||
private StateController stateController;
|
[SerializeField] private PlayerMovement playerController;
|
||||||
|
[SerializeField] private StateController stateController;
|
||||||
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@ -42,17 +44,41 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
// jump
|
|
||||||
// if (Input.GetKeyDown(KeyCode.Space)) {
|
|
||||||
if (playerInput.actions["Jump"].WasPressedThisFrame() && IsGrounded())
|
|
||||||
{
|
|
||||||
_rb.AddForce(Vector2.up * jumpSpeed, ForceMode2D.Impulse);
|
|
||||||
}
|
|
||||||
|
|
||||||
// throw tambourine
|
// throw tambourine
|
||||||
// if (Input.GetKeyDown(KeyCode.K)) {
|
// if (Input.GetKeyDown(KeyCode.K)) {
|
||||||
if (playerInput.actions["ThrowTambourine"].WasPressedThisFrame())
|
if (playerInput.actions["ThrowTambourine"].WasPressedThisFrame())
|
||||||
{
|
{
|
||||||
|
ThrowTambourine();
|
||||||
|
}
|
||||||
|
|
||||||
|
// grapple
|
||||||
|
tambourine = GameObject.FindGameObjectWithTag("tambourine");
|
||||||
|
// if (Input.GetKeyDown(KeyCode.L)) {
|
||||||
|
if (playerInput.actions["Grapple"].WasPressedThisFrame())
|
||||||
|
{
|
||||||
|
AttemptGrapple();
|
||||||
|
}
|
||||||
|
// if (Input.GetKeyUp(KeyCode.L)) {
|
||||||
|
if (playerInput.actions["Grapple"].WasReleasedThisFrame())
|
||||||
|
{
|
||||||
|
LetGoOfGrapple();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnMove(InputValue value)
|
||||||
|
{
|
||||||
|
_hInput = value.Get<Vector2>().x;
|
||||||
|
if (_hInput < 0)
|
||||||
|
{
|
||||||
|
forward = -1;
|
||||||
|
}
|
||||||
|
else if (_hInput > 0)
|
||||||
|
{
|
||||||
|
forward = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThrowTambourine() {
|
||||||
if (hasTambourine && !grapplingRope.isGrappling)
|
if (hasTambourine && !grapplingRope.isGrappling)
|
||||||
{
|
{
|
||||||
launcher.ThrowTambourine(forward);
|
launcher.ThrowTambourine(forward);
|
||||||
@ -60,11 +86,7 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// grapple
|
void AttemptGrapple() {
|
||||||
GameObject tambourine = GameObject.FindGameObjectWithTag("tambourine");
|
|
||||||
// if (Input.GetKeyDown(KeyCode.L)) {
|
|
||||||
if (playerInput.actions["Grapple"].WasPressedThisFrame())
|
|
||||||
{
|
|
||||||
if (tambourine != null)
|
if (tambourine != null)
|
||||||
{ // grapple to tambourine
|
{ // grapple to tambourine
|
||||||
if (!grapplingRope.isGrappling && tambourine.GetComponent<TambourineBehavior>().pinned)
|
if (!grapplingRope.isGrappling && tambourine.GetComponent<TambourineBehavior>().pinned)
|
||||||
@ -82,81 +104,12 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (Input.GetKeyUp(KeyCode.L)) {
|
|
||||||
if (playerInput.actions["Grapple"].WasReleasedThisFrame())
|
void LetGoOfGrapple() {
|
||||||
{
|
|
||||||
if (tambourine != null && grapplingRope.isGrappling)
|
if (tambourine != null && grapplingRope.isGrappling)
|
||||||
{
|
{
|
||||||
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
|
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
|
||||||
}
|
}
|
||||||
grapplingGun.ReleaseGrapple();
|
grapplingGun.ReleaseGrapple();
|
||||||
}
|
}
|
||||||
// if (Input.GetKey(KeyCode.L)) {
|
|
||||||
if (playerInput.actions["Grapple"].IsPressed())
|
|
||||||
{
|
|
||||||
Debug.DrawRay(transform.position, new Vector2(0.500f * forward, 0.866f), Color.green);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnMove(InputValue value)
|
|
||||||
{
|
|
||||||
_hInput = value.Get<Vector2>().x;
|
|
||||||
if (_hInput < 0)
|
|
||||||
{
|
|
||||||
forward = -1;
|
|
||||||
}
|
|
||||||
else if (_hInput > 0)
|
|
||||||
{
|
|
||||||
forward = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void FixedUpdate() {
|
|
||||||
// if (grapplingRope.isGrappling && _hInput != 0 && !IsGrounded()) {
|
|
||||||
// // print("grappling force");
|
|
||||||
// _rb.AddForce(new Vector2(_hInput * (airSpeed / 3), 0));
|
|
||||||
// } else if (_hInput != 0 && !IsGrounded()) {
|
|
||||||
// _rb.AddForce(new Vector2(_hInput * airSpeed, 0));
|
|
||||||
// } else if (_hInput != 0) {
|
|
||||||
// // print("normal movement");
|
|
||||||
// _rb.AddForce(new Vector2(_hInput * moveSpeed, 0));
|
|
||||||
// // _rb.velocity = new Vector2(_hInput * moveSpeed, _rb.velocity.y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
void OnTriggerEnter2D(Collider2D col)
|
|
||||||
{
|
|
||||||
if (col.tag == "grappleSurface")
|
|
||||||
{
|
|
||||||
grappleSurface = col.gameObject;
|
|
||||||
}
|
|
||||||
else if (col.tag == "instaDeath")
|
|
||||||
{
|
|
||||||
stateController.ToggleDeathCanvas();
|
|
||||||
Destroy(this.gameObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnTriggerExit2D(Collider2D col)
|
|
||||||
{
|
|
||||||
if (col.tag == "grappleSurface")
|
|
||||||
{
|
|
||||||
grappleSurface = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsGrounded()
|
|
||||||
{
|
|
||||||
if (Physics2D.BoxCast(transform.position, boxSize, 0, -transform.up, maxDistanceFromGround, groundLayer))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDrawGizmos()
|
|
||||||
{
|
|
||||||
Gizmos.color = Color.red;
|
|
||||||
Gizmos.DrawCube(transform.position - transform.up * maxDistanceFromGround, boxSize);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,11 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
public float maxRunSpeed;
|
public float maxRunSpeed;
|
||||||
public float runAcceleration;
|
public float runAcceleration;
|
||||||
|
public float snappiness = 1;
|
||||||
|
public float jumpSpeed;
|
||||||
|
[Range(0,1)] public float airSpeedMultiplier;
|
||||||
private bool onGround = false;
|
private bool onGround = false;
|
||||||
|
private float forward = 1;
|
||||||
|
|
||||||
float hangTimeThreshold = 0.1f;
|
float hangTimeThreshold = 0.1f;
|
||||||
float hangTimeAccel = 0;
|
float hangTimeAccel = 0;
|
||||||
@ -15,6 +19,22 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
private Vector2 movement = Vector2.zero;
|
private Vector2 movement = Vector2.zero;
|
||||||
|
|
||||||
|
public LayerMask groundLayer;
|
||||||
|
public Vector2 boxSize;
|
||||||
|
public float maxDistanceFromGround;
|
||||||
|
|
||||||
|
[Header("Grappling:")]
|
||||||
|
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||||
|
[SerializeField] public Tutorial_GrapplingRope grapplingRope;
|
||||||
|
private GameObject grappleSurface;
|
||||||
|
|
||||||
|
[Header("Tambourine:")]
|
||||||
|
[SerializeField] private Launch launcher;
|
||||||
|
[HideInInspector] public bool hasTambourine = true;
|
||||||
|
|
||||||
|
[Header("State Control:")]
|
||||||
|
[SerializeField] private StateController stateController;
|
||||||
|
|
||||||
void OnValidate()
|
void OnValidate()
|
||||||
{
|
{
|
||||||
this.runAcceleration = Mathf.Clamp(runAcceleration, 0.1f, this.maxRunSpeed);
|
this.runAcceleration = Mathf.Clamp(runAcceleration, 0.1f, this.maxRunSpeed);
|
||||||
@ -23,6 +43,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
this.rb = this.GetComponent<Rigidbody2D>();
|
this.rb = this.GetComponent<Rigidbody2D>();
|
||||||
|
stateController = GameObject.Find("StateController").GetComponent<StateController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnMove(InputValue value)
|
void OnMove(InputValue value)
|
||||||
@ -31,6 +52,12 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
//Debug.Log(this.movement);
|
//Debug.Log(this.movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnJump() {
|
||||||
|
if (IsGrounded()) {
|
||||||
|
rb.AddForce(Vector2.up * jumpSpeed, ForceMode2D.Impulse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FixedUpdate()
|
void FixedUpdate()
|
||||||
{
|
{
|
||||||
Run(1);
|
Run(1);
|
||||||
@ -46,29 +73,76 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
float targetSpeed = this.movement.x * this.maxRunSpeed;
|
float targetSpeed = this.movement.x * this.maxRunSpeed;
|
||||||
|
|
||||||
float speedDiff = targetSpeed - this.rb.velocity.x;
|
float speedDiff = targetSpeed - this.rb.velocity.x;
|
||||||
|
forward = Mathf.Sign(speedDiff);
|
||||||
|
|
||||||
float accel = 0.5f;
|
float accel = AccelerationRate() * snappiness;
|
||||||
|
|
||||||
float accelRate = (Mathf.Abs(targetSpeed) > 0.1) ? accel : -accel;
|
float accelRate = (Mathf.Abs(targetSpeed) > 0.1) ? accel : -accel;
|
||||||
|
|
||||||
float velPower = 1.0f;
|
float velPower = 1.0f;
|
||||||
|
|
||||||
float move = Mathf.Pow(Mathf.Abs(speedDiff) * accelRate, velPower) * Mathf.Sign(speedDiff);
|
float move = Mathf.Pow(Mathf.Abs(speedDiff) * accelRate, velPower) * forward;
|
||||||
|
|
||||||
this.rb.AddForce(move * Vector2.right, ForceMode2D.Force);
|
this.onGround = IsGrounded();
|
||||||
|
|
||||||
float frictionAmount = 0.5f;
|
float frictionAmount = 0.5f;
|
||||||
|
|
||||||
this.onGround = true;
|
// accelerate
|
||||||
|
if (onGround && (Mathf.Abs(this.movement.x) > 0.1f)) {
|
||||||
|
this.rb.AddForce(move * Vector2.right, ForceMode2D.Force);
|
||||||
|
} else if (!onGround && (Mathf.Abs(this.movement.x) > 0.1f)) {
|
||||||
|
this.rb.AddForce(move * Vector2.right * airSpeedMultiplier, ForceMode2D.Force);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.onGround && (Mathf.Abs(this.movement.x) < 0.1f))
|
// decelerate until stopped
|
||||||
|
if (Mathf.Abs(this.movement.x) < 0.1f)
|
||||||
{
|
{
|
||||||
|
if (Mathf.Abs(rb.velocity.x) > 0.1f) {
|
||||||
float amount = Mathf.Min(
|
float amount = Mathf.Min(
|
||||||
Mathf.Abs(this.rb.velocity.x),
|
Mathf.Abs(this.rb.velocity.x),
|
||||||
Mathf.Abs(frictionAmount)
|
Mathf.Abs(frictionAmount)
|
||||||
);
|
);
|
||||||
amount *= Mathf.Sign(this.rb.velocity.x);
|
amount *= Mathf.Sign(this.rb.velocity.x);
|
||||||
this.rb.AddForce(-amount * Vector2.right, ForceMode2D.Impulse);
|
this.rb.AddForce(-amount * Vector2.right * snappiness, ForceMode2D.Impulse);
|
||||||
|
} else {
|
||||||
|
this.rb.velocity = new Vector2(0, rb.velocity.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTriggerEnter2D(Collider2D col)
|
||||||
|
{
|
||||||
|
if (col.tag == "grappleSurface")
|
||||||
|
{
|
||||||
|
grappleSurface = col.gameObject;
|
||||||
|
}
|
||||||
|
else if (col.tag == "instaDeath")
|
||||||
|
{
|
||||||
|
this.stateController.SetDeathCanvasActive(true);
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTriggerExit2D(Collider2D col)
|
||||||
|
{
|
||||||
|
if (col.tag == "grappleSurface")
|
||||||
|
{
|
||||||
|
grappleSurface = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsGrounded()
|
||||||
|
{
|
||||||
|
if (Physics2D.BoxCast(transform.position, boxSize, 0, -transform.up, maxDistanceFromGround, groundLayer))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDrawGizmos()
|
||||||
|
{
|
||||||
|
Gizmos.color = Color.red;
|
||||||
|
Gizmos.DrawCube(transform.position - transform.up * maxDistanceFromGround, boxSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ public class StateController : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RespawnPlayer() {
|
public void RespawnPlayer() {
|
||||||
ToggleDeathCanvas();
|
SetDeathCanvasActive(false);
|
||||||
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
|
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleDeathCanvas() {
|
public void SetDeathCanvasActive(bool activeState) {
|
||||||
deathCanvas.SetActive(!deathCanvas.activeSelf);
|
deathCanvas.SetActive(activeState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,7 +476,7 @@ Tilemap:
|
|||||||
m_TileColorIndex: 0
|
m_TileColorIndex: 0
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
dummyAlignment: 0
|
dummyAlignment: 0
|
||||||
m_AllTileFlags: 1073741825
|
m_AllTileFlags: 2147483649
|
||||||
- first: {x: 2, y: -7, z: 0}
|
- first: {x: 2, y: -7, z: 0}
|
||||||
second:
|
second:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -1679,7 +1679,7 @@ TilemapRenderer:
|
|||||||
m_Mode: 0
|
m_Mode: 0
|
||||||
m_DetectChunkCullingBounds: 0
|
m_DetectChunkCullingBounds: 0
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
--- !u!114 &541010514327157900
|
--- !u!114 &7222719822761566809
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -33,4 +33,4 @@ MonoBehaviour:
|
|||||||
e33: 1
|
e33: 1
|
||||||
m_InstancedGameObject: {fileID: 0}
|
m_InstancedGameObject: {fileID: 0}
|
||||||
m_Flags: 1
|
m_Flags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 0
|
||||||
|
@ -2364,113 +2364,113 @@ TextureImporter:
|
|||||||
weights: []
|
weights: []
|
||||||
secondaryTextures: []
|
secondaryTextures: []
|
||||||
nameFileIdTable:
|
nameFileIdTable:
|
||||||
tile_cave_platform_48: 860358998
|
tile_cave_platform_0: 187170972
|
||||||
tile_cave_platform_42: 1678161876
|
tile_cave_platform_1: -1566370012
|
||||||
tile_cave_platform_52: -101254409
|
|
||||||
tile_cave_platform_22: -1347213101
|
|
||||||
tile_cave_platform_28: 555492011
|
|
||||||
tile_cave_platform_4: 816183649
|
|
||||||
tile_cave_platform_70: -622248163
|
|
||||||
tile_cave_platform_99: 1725201896
|
|
||||||
tile_cave_platform_12: -1749207181
|
|
||||||
tile_cave_platform_3: -1869149979
|
|
||||||
tile_cave_platform_23: 1444723485
|
|
||||||
tile_cave_platform_37: 891890011
|
|
||||||
tile_cave_platform_83: 437206413
|
|
||||||
tile_cave_platform_56: 990158993
|
|
||||||
tile_cave_platform_82: -748917288
|
|
||||||
tile_cave_platform_101: 30499823
|
|
||||||
tile_cave_platform_81: 1501013548
|
|
||||||
tile_cave_platform_45: -1828034864
|
|
||||||
tile_cave_platform_18: 1982126232
|
|
||||||
tile_cave_platform_25: -610258227
|
|
||||||
tile_cave_platform_74: 208169506
|
|
||||||
tile_cave_platform_10: 1378621459
|
tile_cave_platform_10: 1378621459
|
||||||
tile_cave_platform_55: 1128775583
|
tile_cave_platform_100: 186572125
|
||||||
|
tile_cave_platform_101: 30499823
|
||||||
|
tile_cave_platform_102: 157912657
|
||||||
|
tile_cave_platform_103: -240375783
|
||||||
|
tile_cave_platform_104: 418300172
|
||||||
|
tile_cave_platform_105: 284850178
|
||||||
|
tile_cave_platform_106: 2054305501
|
||||||
|
tile_cave_platform_11: -2102710647
|
||||||
|
tile_cave_platform_12: -1749207181
|
||||||
|
tile_cave_platform_13: 858304779
|
||||||
|
tile_cave_platform_14: 948235904
|
||||||
tile_cave_platform_15: 828061470
|
tile_cave_platform_15: 828061470
|
||||||
tile_cave_platform_16: -1419052898
|
tile_cave_platform_16: -1419052898
|
||||||
tile_cave_platform_41: 691336754
|
|
||||||
tile_cave_platform_38: 1676765538
|
|
||||||
tile_cave_platform_69: 1201609837
|
|
||||||
tile_cave_platform_39: 1594244300
|
|
||||||
tile_cave_platform_32: 300324828
|
|
||||||
tile_cave_platform_21: -411309469
|
|
||||||
tile_cave_platform_47: 2023151002
|
|
||||||
tile_cave_platform_98: 232799033
|
|
||||||
tile_cave_platform_103: -240375783
|
|
||||||
tile_cave_platform_68: -1027637906
|
|
||||||
tile_cave_platform_58: -866399296
|
|
||||||
tile_cave_platform_27: -201151014
|
|
||||||
tile_cave_platform_17: 464019165
|
tile_cave_platform_17: 464019165
|
||||||
|
tile_cave_platform_18: 1982126232
|
||||||
|
tile_cave_platform_19: 535637540
|
||||||
|
tile_cave_platform_2: -1386356081
|
||||||
|
tile_cave_platform_20: -186269060
|
||||||
|
tile_cave_platform_21: -411309469
|
||||||
|
tile_cave_platform_22: -1347213101
|
||||||
|
tile_cave_platform_23: 1444723485
|
||||||
|
tile_cave_platform_24: -1183118302
|
||||||
|
tile_cave_platform_25: -610258227
|
||||||
|
tile_cave_platform_26: -1594682787
|
||||||
|
tile_cave_platform_27: -201151014
|
||||||
|
tile_cave_platform_28: 555492011
|
||||||
|
tile_cave_platform_29: 82606424
|
||||||
|
tile_cave_platform_3: -1869149979
|
||||||
tile_cave_platform_30: -1332320381
|
tile_cave_platform_30: -1332320381
|
||||||
tile_cave_platform_94: 1336928453
|
tile_cave_platform_31: -1331211415
|
||||||
tile_cave_platform_80: -264131660
|
tile_cave_platform_32: 300324828
|
||||||
tile_cave_platform_104: 418300172
|
|
||||||
tile_cave_platform_1: -1566370012
|
|
||||||
tile_cave_platform_33: 554307562
|
tile_cave_platform_33: 554307562
|
||||||
tile_cave_platform_34: -132886666
|
tile_cave_platform_34: -132886666
|
||||||
tile_cave_platform_0: 187170972
|
|
||||||
tile_cave_platform_73: 422422043
|
|
||||||
tile_cave_platform_2: -1386356081
|
|
||||||
tile_cave_platform_90: -2099172758
|
|
||||||
tile_cave_platform_50: 1169626773
|
|
||||||
tile_cave_platform_79: -254508583
|
|
||||||
tile_cave_platform_5: 1941844380
|
|
||||||
tile_cave_platform_89: 1609023694
|
|
||||||
tile_cave_platform_95: 1191579864
|
|
||||||
tile_cave_platform_13: 858304779
|
|
||||||
tile_cave_platform_91: -1907997159
|
|
||||||
tile_cave_platform_46: -1326824629
|
|
||||||
tile_cave_platform_35: -2043734024
|
tile_cave_platform_35: -2043734024
|
||||||
tile_cave_platform_54: 672327527
|
|
||||||
tile_cave_platform_105: 284850178
|
|
||||||
tile_cave_platform_76: 738992274
|
|
||||||
tile_cave_platform_85: -193765208
|
|
||||||
tile_cave_platform_36: -903480771
|
tile_cave_platform_36: -903480771
|
||||||
tile_cave_platform_7: -1680641961
|
tile_cave_platform_37: 891890011
|
||||||
tile_cave_platform_100: 186572125
|
tile_cave_platform_38: 1676765538
|
||||||
tile_cave_platform_11: -2102710647
|
tile_cave_platform_39: 1594244300
|
||||||
tile_cave_platform_57: -660347865
|
tile_cave_platform_4: 816183649
|
||||||
tile_cave_platform_19: 535637540
|
|
||||||
tile_cave_platform_26: -1594682787
|
|
||||||
tile_cave_platform_63: -268434342
|
|
||||||
tile_cave_platform_77: -1772568650
|
|
||||||
tile_cave_platform_92: 1436478779
|
|
||||||
tile_cave_platform_31: -1331211415
|
|
||||||
tile_cave_platform_87: -1728563952
|
|
||||||
tile_cave_platform_96: 1096025109
|
|
||||||
tile_cave_platform_40: -1517529945
|
tile_cave_platform_40: -1517529945
|
||||||
tile_cave_platform_93: 596793319
|
tile_cave_platform_41: 691336754
|
||||||
|
tile_cave_platform_42: 1678161876
|
||||||
|
tile_cave_platform_43: -408254474
|
||||||
|
tile_cave_platform_44: 332401312
|
||||||
|
tile_cave_platform_45: -1828034864
|
||||||
|
tile_cave_platform_46: -1326824629
|
||||||
|
tile_cave_platform_47: 2023151002
|
||||||
|
tile_cave_platform_48: 860358998
|
||||||
|
tile_cave_platform_49: -1431529915
|
||||||
|
tile_cave_platform_5: 1941844380
|
||||||
|
tile_cave_platform_50: 1169626773
|
||||||
|
tile_cave_platform_51: -2103391120
|
||||||
|
tile_cave_platform_52: -101254409
|
||||||
|
tile_cave_platform_53: 368925175
|
||||||
|
tile_cave_platform_54: 672327527
|
||||||
|
tile_cave_platform_55: 1128775583
|
||||||
|
tile_cave_platform_56: 990158993
|
||||||
|
tile_cave_platform_57: -660347865
|
||||||
|
tile_cave_platform_58: -866399296
|
||||||
|
tile_cave_platform_59: 878730313
|
||||||
|
tile_cave_platform_6: -1806684432
|
||||||
|
tile_cave_platform_60: -270402943
|
||||||
|
tile_cave_platform_61: 1707607318
|
||||||
|
tile_cave_platform_62: 780055922
|
||||||
|
tile_cave_platform_63: -268434342
|
||||||
|
tile_cave_platform_64: 784849295
|
||||||
tile_cave_platform_65: -1180649061
|
tile_cave_platform_65: -1180649061
|
||||||
tile_cave_platform_66: -1656921007
|
tile_cave_platform_66: -1656921007
|
||||||
tile_cave_platform_64: 784849295
|
|
||||||
tile_cave_platform_86: -983927808
|
|
||||||
tile_cave_platform_9: 840204991
|
|
||||||
tile_cave_platform_59: 878730313
|
|
||||||
tile_cave_platform_106: 2054305501
|
|
||||||
tile_cave_platform_6: -1806684432
|
|
||||||
tile_cave_platform_53: 368925175
|
|
||||||
tile_cave_platform_60: -270402943
|
|
||||||
tile_cave_platform_24: -1183118302
|
|
||||||
tile_cave_platform_61: 1707607318
|
|
||||||
tile_cave_platform_43: -408254474
|
|
||||||
tile_cave_platform_78: -1319854462
|
|
||||||
tile_cave_platform_71: 431461063
|
|
||||||
tile_cave_platform_88: -345751969
|
|
||||||
tile_cave_platform_49: -1431529915
|
|
||||||
tile_cave_platform_97: -809172117
|
|
||||||
tile_cave_platform_51: -2103391120
|
|
||||||
tile_cave_platform_62: 780055922
|
|
||||||
tile_cave_platform_84: 1328316489
|
|
||||||
tile_cave_platform_44: 332401312
|
|
||||||
tile_cave_platform_20: -186269060
|
|
||||||
tile_cave_platform_29: 82606424
|
|
||||||
tile_cave_platform_75: -1873221857
|
|
||||||
tile_cave_platform_14: 948235904
|
|
||||||
tile_cave_platform_102: 157912657
|
|
||||||
tile_cave_platform_72: 2028675851
|
|
||||||
tile_cave_platform_8: -1443274602
|
|
||||||
tile_cave_platform_67: -1117257055
|
tile_cave_platform_67: -1117257055
|
||||||
|
tile_cave_platform_68: -1027637906
|
||||||
|
tile_cave_platform_69: 1201609837
|
||||||
|
tile_cave_platform_7: -1680641961
|
||||||
|
tile_cave_platform_70: -622248163
|
||||||
|
tile_cave_platform_71: 431461063
|
||||||
|
tile_cave_platform_72: 2028675851
|
||||||
|
tile_cave_platform_73: 422422043
|
||||||
|
tile_cave_platform_74: 208169506
|
||||||
|
tile_cave_platform_75: -1873221857
|
||||||
|
tile_cave_platform_76: 738992274
|
||||||
|
tile_cave_platform_77: -1772568650
|
||||||
|
tile_cave_platform_78: -1319854462
|
||||||
|
tile_cave_platform_79: -254508583
|
||||||
|
tile_cave_platform_8: -1443274602
|
||||||
|
tile_cave_platform_80: -264131660
|
||||||
|
tile_cave_platform_81: 1501013548
|
||||||
|
tile_cave_platform_82: -748917288
|
||||||
|
tile_cave_platform_83: 437206413
|
||||||
|
tile_cave_platform_84: 1328316489
|
||||||
|
tile_cave_platform_85: -193765208
|
||||||
|
tile_cave_platform_86: -983927808
|
||||||
|
tile_cave_platform_87: -1728563952
|
||||||
|
tile_cave_platform_88: -345751969
|
||||||
|
tile_cave_platform_89: 1609023694
|
||||||
|
tile_cave_platform_9: 840204991
|
||||||
|
tile_cave_platform_90: -2099172758
|
||||||
|
tile_cave_platform_91: -1907997159
|
||||||
|
tile_cave_platform_92: 1436478779
|
||||||
|
tile_cave_platform_93: 596793319
|
||||||
|
tile_cave_platform_94: 1336928453
|
||||||
|
tile_cave_platform_95: 1191579864
|
||||||
|
tile_cave_platform_96: 1096025109
|
||||||
|
tile_cave_platform_97: -809172117
|
||||||
|
tile_cave_platform_98: 232799033
|
||||||
|
tile_cave_platform_99: 1725201896
|
||||||
mipmapLimitGroupName:
|
mipmapLimitGroupName:
|
||||||
pSDRemoveMatte: 0
|
pSDRemoveMatte: 0
|
||||||
userData:
|
userData:
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 23938e9b94b9022413054828a87c05d8f5decc2b
|
Subproject commit 413bfb2c6937c2d11546a7a81aed5ae43d5cc147
|
Loading…
Reference in New Issue
Block a user