Cannot Grapple Spikes anymore

This commit is contained in:
louishorlaville 2022-10-30 17:25:58 -04:00
parent b3a56f79bd
commit 1c8c15c7ef

View File

@ -91,15 +91,27 @@ public class GrappleHook : MonoBehaviour
if(!hitMarkerRect.gameObject.activeSelf)hitMarkerRect.gameObject.SetActive(true);
hitMarkerRect.anchoredPosition = WorldToUI(gameObject.transform.position + aimDir * maxGrappleDist);
if(Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)){
hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
if (Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)) {
if (hit.transform.gameObject.layer != 7)
{
hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
if(grappling){
StartGrapple(hit);
}else{
grappling = false;
if (grappling)
{
StartGrapple(hit);
}
else
{
grappling = false;
}
}
else
{
hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
}
}else{
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
}