Pull request #24: Coins

Merge in CEGJ/32bit_jam_conjure from Coins to Dev

* commit 'dc38bdbdb7aa7e24770c1713c06b6c4700ae19c5':
  collected coin amount is displayed in end scene
  Collected coin amount is displayed
  Collected coin amount is tracked
  Add guiding coins Remove grapple charges
  Added collectible to recharge grapple
This commit is contained in:
Soulaha 2022-10-30 03:38:18 +00:00 committed by Louis Horlaville
commit f40d0bcc5e
12 changed files with 8123 additions and 4 deletions

View File

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

View File

@ -0,0 +1,116 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7330076085198802814
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7330076085198802813}
- component: {fileID: 7330076085198802810}
- component: {fileID: 7330076085198802811}
- component: {fileID: 7330076085198802812}
- component: {fileID: 7330076085198802809}
m_Layer: 2
m_Name: Collectible
m_TagString: Collectible
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7330076085198802813
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7330076085198802814}
m_LocalRotation: {x: -0, y: -0, z: 0.18729897, w: 0.982303}
m_LocalPosition: {x: 17.7, y: 6.27, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 21.59}
--- !u!33 &7330076085198802810
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7330076085198802814}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &7330076085198802811
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7330076085198802814}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!136 &7330076085198802812
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7330076085198802814}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &7330076085198802809
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7330076085198802814}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fad65f8e0d6747f4b8e79104b58b08b6, type: 3}
m_Name:
m_EditorClassIdentifier:
amount: 1
rotSpeed: 5
timeToAppear: 3

View File

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

View File

@ -30,6 +30,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 3756227406995876155}
- {fileID: 2391504647050640505} - {fileID: 2391504647050640505}
m_Father: {fileID: 4515361964050757684} m_Father: {fileID: 4515361964050757684}
m_RootOrder: 0 m_RootOrder: 0
@ -56,7 +57,7 @@ Canvas:
m_OverrideSorting: 0 m_OverrideSorting: 0
m_OverridePixelPerfect: 0 m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0 m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0 m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 100 m_SortingOrder: 100
m_TargetDisplay: 0 m_TargetDisplay: 0
@ -72,7 +73,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_UiScaleMode: 0 m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100 m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1 m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600} m_ReferenceResolution: {x: 800, y: 600}
@ -133,6 +134,7 @@ MonoBehaviour:
endScene: ThanksScene endScene: ThanksScene
fadeSpeed: 2.5 fadeSpeed: 2.5
fadeImg: {fileID: 3902665078773332606} fadeImg: {fileID: 3902665078773332606}
coinText: {fileID: 3994057406749197163}
--- !u!1 &5180033606312474289 --- !u!1 &5180033606312474289
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -164,7 +166,7 @@ RectTransform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1679323109552408359} m_Father: {fileID: 1679323109552408359}
m_RootOrder: 0 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
@ -209,3 +211,140 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!1 &6425620667288338338
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3756227406995876155}
- component: {fileID: 6600796015951369727}
- component: {fileID: 3994057406749197163}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3756227406995876155
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6425620667288338338}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1679323109552408359}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 10, y: -10}
m_SizeDelta: {x: 30, y: 30}
m_Pivot: {x: 0, y: 1}
--- !u!222 &6600796015951369727
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6425620667288338338}
m_CullTransparentMesh: 1
--- !u!114 &3994057406749197163
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6425620667288338338}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: '0
'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: e73a58f6e2794ae7b1b7e50b7fb811b0, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 26.85
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}

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:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collectible : MonoBehaviour
{
[SerializeField]
private int amount;
[SerializeField]
private float rotSpeed;
[SerializeField]
private float timeToAppear;
void Update()
{
transform.Rotate(0, rotSpeed, 0, Space.World);
}
private void OnTriggerEnter(Collider other) {
if(other.gameObject.tag.Equals("Player")){
GameController.Instance.AddCoins(amount);
Vanish();
}
}
private void Vanish(){
gameObject.SetActive(false);
if(timeToAppear > -1){
Invoke("Appear", timeToAppear);
}else{
Destroy(this.gameObject);
}
}
private void Appear(){
gameObject.SetActive(true);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fad65f8e0d6747f4b8e79104b58b08b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using UnityEngine.UI; using UnityEngine.UI;
using TMPro;
public class GameController : MonoBehaviour public class GameController : MonoBehaviour
{ {
@ -13,7 +14,11 @@ public class GameController : MonoBehaviour
private float fadeSpeed; private float fadeSpeed;
[SerializeField] [SerializeField]
private Image fadeImg; private Image fadeImg;
[SerializeField]
private TMP_Text coinText;
private Coroutine fadeCoroutine; private Coroutine fadeCoroutine;
private int coinAmount = 0;
public int CoinAmount{get=>coinAmount;}
public static GameController Instance{ public static GameController Instance{
get{ get{
if(instance is null)Debug.LogError("Game controller is null"); if(instance is null)Debug.LogError("Game controller is null");
@ -26,11 +31,25 @@ public class GameController : MonoBehaviour
instance = this; instance = this;
DontDestroyOnLoad(this.gameObject); DontDestroyOnLoad(this.gameObject);
SceneManager.activeSceneChanged += ChangedScene; SceneManager.activeSceneChanged += ChangedScene;
coinText.text = "0";
if(!SceneManager.GetActiveScene().name.Equals(mainScene) && !SceneManager.GetActiveScene().name.Equals(endScene)){
Debug.Log(SceneManager.GetActiveScene().name);
coinText.gameObject.SetActive(false);
}else{
Debug.Log(SceneManager.GetActiveScene().name);
coinText.gameObject.SetActive(true);
}
}else{ }else{
Destroy(this.gameObject); Destroy(this.gameObject);
} }
} }
public void AddCoins(int amount){
//This should not be like this. Collectible should call the player that hit it and add to their amount
coinAmount += amount;
coinText.text = coinAmount.ToString();
}
public void StartGame(){ public void StartGame(){
@ -58,6 +77,12 @@ public class GameController : MonoBehaviour
private void ChangedScene(Scene curr, Scene next){ private void ChangedScene(Scene curr, Scene next){
fadeCoroutine = StartCoroutine(FadeToBlack(string.Empty, false, fadeSpeed)); fadeCoroutine = StartCoroutine(FadeToBlack(string.Empty, false, fadeSpeed));
if(!next.name.Equals(mainScene) && !next.name.Equals(endScene)){
Debug.Log(endScene);
coinText.gameObject.SetActive(false);
}else{
coinText.gameObject.SetActive(true);
}
} }
public IEnumerator FadeToBlack(string sceneToLoad,bool fadeToBlack = true, float fadeSpeed = 2.5f){ public IEnumerator FadeToBlack(string sceneToLoad,bool fadeToBlack = true, float fadeSpeed = 2.5f){

View File

@ -45,6 +45,7 @@ public class GrappleHook : MonoBehaviour
float changingLengthDir = 0; float changingLengthDir = 0;
private Vector3 currGrappleEndPos; private Vector3 currGrappleEndPos;
private GameObject hookedTo; // The obj we are hooked to private GameObject hookedTo; // The obj we are hooked to
public GameObject HookedTo{get => hookedTo; set => hookedTo = value;} public GameObject HookedTo{get => hookedTo; set => hookedTo = value;}
public bool isGrappled() public bool isGrappled()
@ -93,8 +94,11 @@ 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);
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green; hitMarkerRect.gameObject.GetComponent<Image>().color = Color.green;
if(grappling){ if(grappling){
StartGrapple(hit); StartGrapple(hit);
}else{
grappling = false;
} }
}else{ }else{
hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red; hitMarkerRect.gameObject.GetComponent<Image>().color = Color.red;
@ -119,8 +123,8 @@ public class GrappleHook : MonoBehaviour
} }
private void StartGrapple(RaycastHit hit){ private void StartGrapple(RaycastHit hit){
grappled = true;
grappling = false; grappling = false;
grappled = true;
soundPlayer.PlaySound("PlayerGrappleHit"); soundPlayer.PlaySound("PlayerGrappleHit");
@ -196,6 +200,7 @@ public void Unhook(GameObject hookedObj){
if(hookedObj.Equals(hookedTo)) if(hookedObj.Equals(hookedTo))
EndGrapple(); EndGrapple();
} }
#endregion #endregion
#region InputActions #region InputActions

View File

@ -5,6 +5,7 @@ TagManager:
serializedVersion: 2 serializedVersion: 2
tags: tags:
- Vanishing - Vanishing
- Collectible
layers: layers:
- Default - Default
- TransparentFX - TransparentFX