Add guiding coins
Remove grapple charges
This commit is contained in:
parent
ba4ef9f55f
commit
f29d349fde
8
Assets/Models/Rocks/Materials.meta
Normal file
8
Assets/Models/Rocks/Materials.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53056f94da94bf547aa8c99f5ddc65c3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
6001
Assets/Scenes/Collectibles.unity
Normal file
6001
Assets/Scenes/Collectibles.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/Collectibles.unity.meta
Normal file
7
Assets/Scenes/Collectibles.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b21d108029ebabd49b8c106e7d982efb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -18,14 +18,18 @@ public class Collectible : MonoBehaviour
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if(other.gameObject.tag.Equals("Player")){
|
||||
other.gameObject.GetComponent<GrappleHook>().AddCharge(amount);
|
||||
Vanish();
|
||||
}
|
||||
}
|
||||
|
||||
private void Vanish(){
|
||||
gameObject.SetActive(false);
|
||||
Invoke("Appear", timeToAppear);
|
||||
if(timeToAppear > -1){
|
||||
Invoke("Appear", timeToAppear);
|
||||
}else{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Appear(){
|
||||
|
||||
@ -26,8 +26,6 @@ public class GrappleHook : MonoBehaviour
|
||||
private LayerMask grappleableLayer;
|
||||
[SerializeField]
|
||||
private float aimSpeed = 50f;
|
||||
[SerializeField]
|
||||
private int charges = 5;
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField]
|
||||
@ -95,12 +93,7 @@ public class GrappleHook : MonoBehaviour
|
||||
|
||||
if(Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)){
|
||||
hitMarkerRect.anchoredPosition = WorldToUI(hit.point);
|
||||
if(charges > 0){
|
||||
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
|
||||
}else{
|
||||
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
|
||||
}
|
||||
|
||||
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
|
||||
|
||||
if(grappling){
|
||||
StartGrapple(hit);
|
||||
@ -131,7 +124,6 @@ public class GrappleHook : MonoBehaviour
|
||||
}
|
||||
private void StartGrapple(RaycastHit hit){
|
||||
grappling = false;
|
||||
if(charges <= 0)return;
|
||||
grappled = true;
|
||||
|
||||
soundPlayer.PlaySound("PlayerGrappleHit");
|
||||
@ -163,7 +155,6 @@ public class GrappleHook : MonoBehaviour
|
||||
}
|
||||
hookedTo = hit.transform.gameObject;
|
||||
currGrappleEndPos = transform.position;
|
||||
charges--;
|
||||
}
|
||||
|
||||
private void EndGrapple(){
|
||||
@ -210,9 +201,6 @@ public void Unhook(GameObject hookedObj){
|
||||
EndGrapple();
|
||||
}
|
||||
|
||||
public void AddCharge(int amount){
|
||||
charges += amount;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region InputActions
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user