Add guiding coins

Remove grapple charges
This commit is contained in:
Soulaha Balde 2022-10-29 22:30:08 -04:00
parent ba4ef9f55f
commit f29d349fde
5 changed files with 6023 additions and 15 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 53056f94da94bf547aa8c99f5ddc65c3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b21d108029ebabd49b8c106e7d982efb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -18,14 +18,18 @@ public class Collectible : MonoBehaviour
private void OnTriggerEnter(Collider other) { private void OnTriggerEnter(Collider other) {
if(other.gameObject.tag.Equals("Player")){ if(other.gameObject.tag.Equals("Player")){
other.gameObject.GetComponent<GrappleHook>().AddCharge(amount);
Vanish(); Vanish();
} }
} }
private void Vanish(){ private void Vanish(){
gameObject.SetActive(false); gameObject.SetActive(false);
Invoke("Appear", timeToAppear); if(timeToAppear > -1){
Invoke("Appear", timeToAppear);
}else{
Destroy(this.gameObject);
}
} }
private void Appear(){ private void Appear(){

View File

@ -26,8 +26,6 @@ public class GrappleHook : MonoBehaviour
private LayerMask grappleableLayer; private LayerMask grappleableLayer;
[SerializeField] [SerializeField]
private float aimSpeed = 50f; private float aimSpeed = 50f;
[SerializeField]
private int charges = 5;
[Header("References")] [Header("References")]
[SerializeField] [SerializeField]
@ -95,12 +93,7 @@ public class GrappleHook : MonoBehaviour
if(Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)){ if(Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)){
hitMarkerRect.anchoredPosition = WorldToUI(hit.point); hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
if(charges > 0){ hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
}else{
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
}
if(grappling){ if(grappling){
StartGrapple(hit); StartGrapple(hit);
@ -131,7 +124,6 @@ public class GrappleHook : MonoBehaviour
} }
private void StartGrapple(RaycastHit hit){ private void StartGrapple(RaycastHit hit){
grappling = false; grappling = false;
if(charges <= 0)return;
grappled = true; grappled = true;
soundPlayer.PlaySound("PlayerGrappleHit"); soundPlayer.PlaySound("PlayerGrappleHit");
@ -163,7 +155,6 @@ public class GrappleHook : MonoBehaviour
} }
hookedTo = hit.transform.gameObject; hookedTo = hit.transform.gameObject;
currGrappleEndPos = transform.position; currGrappleEndPos = transform.position;
charges--;
} }
private void EndGrapple(){ private void EndGrapple(){
@ -210,9 +201,6 @@ public void Unhook(GameObject hookedObj){
EndGrapple(); EndGrapple();
} }
public void AddCharge(int amount){
charges += amount;
}
#endregion #endregion
#region InputActions #region InputActions