edit: attempted polish but failed
This commit is contained in:
		
							parent
							
								
									d59a00fdd3
								
							
						
					
					
						commit
						0001809418
					
				
					 58 changed files with 11705 additions and 140 deletions
				
			
		
							
								
								
									
										8
									
								
								Assets/Scripts/EntityScripts.meta
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/EntityScripts.meta
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: eb26112da6fce9c4ca2610cb953c66e6 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										45
									
								
								Assets/Scripts/EntityScripts/BoardVisuals.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								Assets/Scripts/EntityScripts/BoardVisuals.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using Lemon.GenericLib.VFX; | ||||
| 
 | ||||
| public class BoardVisuals : MonoBehaviour | ||||
| { | ||||
| 
 | ||||
|     [Header("Runtime")] | ||||
|     [Space] | ||||
|     [Header("Refereces")] | ||||
|     [SerializeField] private float shakeDuration = 0.1f; | ||||
|      private GameBoard gameBoard; | ||||
|      private  CameraController cameraController; | ||||
| 
 | ||||
| 
 | ||||
|     private bool initialized = false; | ||||
| 
 | ||||
|     private void CheckInit() | ||||
|     { | ||||
|         if (!initialized) | ||||
|         { | ||||
|             //initialization code here | ||||
|             gameBoard = GetComponent<GameBoard>(); | ||||
|             cameraController = CameraController.instanceCC; | ||||
|             gameBoard.onDrop += shakeOnDrop; | ||||
|             initialized = true; | ||||
|         } | ||||
|     } | ||||
|     private void Start() | ||||
|     { | ||||
|         CheckInit(); | ||||
|     } | ||||
| 
 | ||||
|     private void OnDestroy() | ||||
|     { | ||||
|         CheckInit(); | ||||
|         gameBoard.onDrop -= shakeOnDrop; | ||||
|     } | ||||
| 
 | ||||
|     private void shakeOnDrop() { | ||||
|         CheckInit(); | ||||
|         if (gameBoard.controlledByPlayer) cameraController?.ApplyScreenShake(shakeDuration, true); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/EntityScripts/BoardVisuals.cs.meta
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/EntityScripts/BoardVisuals.cs.meta
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: 638bc47cbd1ff1d4ca0da9eb2373d01d | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										84
									
								
								Assets/Scripts/EntityScripts/TileVisuals.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								Assets/Scripts/EntityScripts/TileVisuals.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,84 @@ | |||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using Lemon.GenericLib.VFX; | ||||
| 
 | ||||
| public class TileVisuals : MonoBehaviour | ||||
| { | ||||
| 
 | ||||
|     [Header("Runtime")] | ||||
|     [Space] | ||||
|     [Header("Refereces")] | ||||
|     private TileDrawer tileDrawer; | ||||
|     [SerializeField] private HitFlash frontFlash; | ||||
|     [SerializeField] private HitFlash backFlash; | ||||
|     [SerializeField] private float flashDuration; | ||||
|     [SerializeField] private float shakeDuration = 0.2f; | ||||
|     private float entireDuration = 1.5f; | ||||
|      private VFX_Manager vfxManager; | ||||
|     private CameraController cameraController; | ||||
|     private bool isPlayer; | ||||
|     private bool initialized = false; | ||||
|      | ||||
| 
 | ||||
|     private void CheckInit() | ||||
|     { | ||||
|         if (!initialized) | ||||
|         { | ||||
|             //initialization code here | ||||
|             tileDrawer = GetComponent<TileDrawer>(); | ||||
|             entireDuration = tileDrawer.board.CollapseCycleTime; | ||||
|             isPlayer = tileDrawer.board.controlledByPlayer; | ||||
|             tileDrawer.onStateChange += updateVisuals; | ||||
|             vfxManager = VFX_Manager.insatnceVFXM; | ||||
|             cameraController = CameraController.instanceCC; | ||||
|             initialized = true; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void Start() | ||||
|     { | ||||
|         CheckInit(); | ||||
|     } | ||||
|    | ||||
| 
 | ||||
|     private void updateVisuals(TileDrawer.TileState tileState){ | ||||
|         CheckInit(); | ||||
|         switch (tileState) | ||||
|         { | ||||
|             case TileDrawer.TileState.idle: | ||||
|                 break; | ||||
|             case TileDrawer.TileState.pending: | ||||
|                 StopCoroutine(FlashingCoroutine()); | ||||
|                 StartCoroutine(FlashingCoroutine()); | ||||
|                 break; | ||||
|             case TileDrawer.TileState.poof: | ||||
|                 vfxManager?.spawnVFX("Explosion", transform.position); | ||||
|                 vfxManager?.spawnVFX("ParticlePuff", transform.position); | ||||
|                 if (isPlayer) { | ||||
|                     Debug.Log("bro!!!'"); | ||||
|                     cameraController?.ApplyScreenShake(shakeDuration,10, true); //why does this not work!!! | ||||
|                 } | ||||
|                 | ||||
|                 break; | ||||
|             case TileDrawer.TileState.dropped: | ||||
|                 vfxManager?.spawnVFX("ParticlePound", transform.position + (Vector3.down * 0.5f)); | ||||
|                 break; | ||||
|             case TileDrawer.TileState.none: | ||||
|                 break; | ||||
|             default: | ||||
|                 break; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     IEnumerator FlashingCoroutine() { | ||||
|         frontFlash.Flash(flashDuration); | ||||
|         //backFlash.Flash(flashDuration); | ||||
|         yield return new WaitForSeconds(entireDuration - (flashDuration * 3)); | ||||
|         frontFlash.Flash(flashDuration); | ||||
|        // backFlash.Flash(flashDuration); | ||||
|         yield return new WaitForSeconds(flashDuration * 2); | ||||
|         frontFlash.Flash(flashDuration); | ||||
|         //backFlash.Flash(flashDuration); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/EntityScripts/TileVisuals.cs.meta
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/EntityScripts/TileVisuals.cs.meta
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: ba56949b19f58e34da285c0974ae5092 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/GameManagerScripts.meta
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/GameManagerScripts.meta
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: 7bdec22f29afa8245899160b77f09c8f | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
|  | @ -207,6 +207,7 @@ namespace Lemon.GenericLib.VFX { | |||
|         public void ApplyScreenShake(float duration, float newShakePower, bool isSmall = false) | ||||
|         { | ||||
|             //cb.enabled = false; | ||||
|             Debug.Log("shake man!!!'"); | ||||
|             StopCoroutine("Screenshake"); | ||||
|             StartCoroutine(Screenshake(duration, newShakePower, isSmall)); | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										57
									
								
								Assets/Scripts/LemonGenericLib/Visual Effects/HitFlash.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								Assets/Scripts/LemonGenericLib/Visual Effects/HitFlash.cs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| 
 | ||||
| namespace Lemon.GenericLib.VFX { | ||||
|     public class HitFlash : MonoBehaviour | ||||
|     { | ||||
|         public float flashDuration = 0.1f; | ||||
|         public SpriteRenderer sr; | ||||
|         public Material flashMaterial; | ||||
|         private Material defaultMaterial; | ||||
|         public bool getSR = false; | ||||
| 
 | ||||
|         private void Start() | ||||
|         { | ||||
|             if (getSR) sr = GetComponent<SpriteRenderer>(); | ||||
| 
 | ||||
|             defaultMaterial = sr.material; | ||||
|         } | ||||
| 
 | ||||
|         public void SetFlash(bool isFlashing = true) | ||||
|         { | ||||
|             if (isFlashing) sr.material = flashMaterial; | ||||
|             else sr.material = defaultMaterial; | ||||
|         } | ||||
| 
 | ||||
|         public void Flash() | ||||
|         { | ||||
|             StartCoroutine(FlashRoutine()); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void Flash(float duration) | ||||
|         { | ||||
|             StartCoroutine(FlashRoutine(duration)); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         IEnumerator FlashRoutine() | ||||
|         { | ||||
|             sr.material = flashMaterial; | ||||
|             yield return new WaitForSeconds(flashDuration); | ||||
|             sr.material = defaultMaterial; | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         IEnumerator FlashRoutine(float duration) | ||||
|         { | ||||
|             sr.material = flashMaterial; | ||||
|             yield return new WaitForSeconds(duration); | ||||
|             sr.material = defaultMaterial; | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -0,0 +1,11 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: 48efeb9de946548478eb2727ae3f55eb | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/ScriptableObjectScripts.meta
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/ScriptableObjectScripts.meta
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: e8e3cbd1de7025044a7a92113d6e88f0 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
|  | @ -20,7 +20,6 @@ public class BoardUIScript : MonoBehaviour | |||
|     [SerializeField] private TextMeshPro warningTMP; | ||||
|     [SerializeField] private GameObject warningOBJ; | ||||
|     [SerializeField] private GameObject comboOBJ; | ||||
|     [SerializeField] private int playerIndex; | ||||
|     [SerializeField] private float scoreJumpDistance = 0.25f; | ||||
|     [SerializeField] private float scoreJumpTime = 0.5f; | ||||
|     [SerializeField] private float comboUITimer = 3f; | ||||
|  | @ -33,7 +32,7 @@ public class BoardUIScript : MonoBehaviour | |||
|         if (!initialized) | ||||
|         { | ||||
|             //initialization code here | ||||
|             titleTMP.text = "Player " + playerIndex; | ||||
|             titleTMP.text = "Player"; | ||||
|             scoreTMP.text = "0"; | ||||
|             comboTMP.text = "x0"; | ||||
|             warningTMP.text = "x0"; | ||||
|  | @ -101,6 +100,11 @@ public class BoardUIScript : MonoBehaviour | |||
|         warningTMP.transform.LeanMoveLocalY(warningTextOriginY + scoreJumpDistance, scoreJumpTime).setLoopPingPong(1).setEase(LeanTweenType.easeOutQuad).setOnComplete(() => warningTMP.transform.LeanMoveLocalY(warningTextOriginY, 0)); | ||||
|     } | ||||
| 
 | ||||
|     public void SetPlayerName(string value) | ||||
|     { | ||||
|         titleTMP.text = value; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue