| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- using o0.Num;
- using o0.Wave.RealTime.Old;
- using Org.BouncyCastle.Security;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.WebSockets;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- public enum EndGameReason
- {
- UserExit,
- GameOver,
- }
- public class GamingManager : MonoBehaviour
- {
- private SmartBowManager bowManager;
- private AudioManager audioManager;
- [SerializeField] private AudioSource BowFireAudio;
- [SerializeField] private AudioSource LooseLifeAudio;
- [SerializeField] private GameObject FruitPrefab;
- [SerializeField] private GameObject ArrowPrefab;
- [SerializeField] private GameObject ComboTextPrefab;
- [SerializeField] private GameObject CriticalTextPrefab;
- [SerializeField] private GameObject AddLifeTextPrefab;
- [SerializeField] private GameObject GamingUIContainer;
- [SerializeField] private Image AimingCross_img;
- [SerializeField] private GameObject Resume_btn;
- [SerializeField] private GameObject Pause_btn;
- [SerializeField] private GameObject Exit_btn;
- [SerializeField] private Image Life_0_img;
- [SerializeField] private Image Life_1_img;
- [SerializeField] private Image Life_2_img;
- [SerializeField] private TextMeshProUGUI ScoreText;
- [SerializeField] private CannonController Cannon;
- [SerializeField] private GameObject FullscreenClearBubble;
- [SerializeField] private int StartScores;
- [SerializeField] private float AimingCrossPosMultiplier = 1f;
- [SerializeField] private Camera Cam;
- public const float ArrowSpeedMultiplier = 8.0f;
- public const float GravityMultiplier = 2.5f;
- private Quaternion CurrentRotation;
- private int Scores;
- private int Combos;
- private int Life;
- private bool bGameStarted;
- private bool bGamePaused;
- // FrozenBanana related variables
- private bool bFreeze;
- private bool bFreezing;
- private float FreezeTimeEclipsed;
- // ComboPomegarante related variables
- private bool bEnterComboTime;
- private bool bComboTime;
- private float ComboTimeEclipsed;
- FruitBehavior ActiveComboPomegarante;
- List<Vector3> FruitVelocityCache_Linear = new List<Vector3>();
- List<Vector3> FruitVelocityCache_Angular = new List<Vector3>();
- private float MakeNewWaveCountdown;
- private List<GameObject> FruitsInField = new List<GameObject>();
- private List<FruitType> FruitsPendingSpawn = new List<FruitType>();
- private float TimeSinceLastFruitSpawn = 0f;
- public delegate void GameEndDelegate(EndGameReason reason, int scores);
- public event GameEndDelegate OnGameEnd;
- private int FruitWaves = 0;
- private Vector2 ScreenMidPoint;
- private float FireCooldownTime_Current = 0f;
- private const float FireCooldownTime = 0.5f;
- private void Awake()
- {
- audioManager = gameObject.GetComponent<AudioManager>();
- Debug.Assert(audioManager);
- bowManager = gameObject.GetComponent<SmartBowManager>();
- Debug.Assert(bowManager);
- Debug.Assert(Cannon);
- ScreenMidPoint = new Vector2(Screen.width / 2, Screen.height / 2);
- }
- // Start is called before the first frame update
- void Start()
- {
- Resume_btn.GetComponentInChildren<Button>().onClick.AddListener(ResumeGame);
- Pause_btn.GetComponentInChildren<Button>().onClick.AddListener(PauseGame);
- Exit_btn.GetComponentInChildren<Button>().onClick.AddListener(ExitGame);
- if (ShootCheck.ins) ShootCheck.ins.OnGameShoot += SmartBowFireArrow;
- AimingCross_img.gameObject.SetActive(false);
- Resume_btn.gameObject.SetActive(false);
- ShowGamingUI(false);
- Physics.gravity = new Vector3(0.0f, -9.8f * GravityMultiplier, 0.0f);
- // Audio track start point correction only
- BowFireAudio.timeSamples = 3000;
- // Play background music
- AudioSource backgroundMusic = gameObject.GetComponent<AudioSource>();
- backgroundMusic.clip = audioManager.GetBackgroundMusic();
- backgroundMusic.Play();
- }
- private void OnDestroy()
- {
- if (ShootCheck.ins) ShootCheck.ins.OnGameShoot -= SmartBowFireArrow;
- }
- // Update is called once per frame
- void Update()
- {
- if (FireCooldownTime_Current > 0f)
- {
- FireCooldownTime_Current = Mathf.Clamp(FireCooldownTime_Current - Time.deltaTime, 0f, FireCooldownTime);
- }
- if (bGameStarted && !bGamePaused)
- {
- // listen to mouse firing arrow
- if (Input.GetMouseButtonDown(0) && BowCamera.isTouchMode)
- {
- AimingCross_img.gameObject.GetComponent<RectTransform>().position = Input.mousePosition;
- MouseFireArrow(Input.mousePosition);
- }
- if (FruitsPendingSpawn.Count > 0)
- {
- if (TimeSinceLastFruitSpawn > GamingValues.SpawnFruitInterval)
- {
- if (!Cannon.IsFireAnimating())
- {
- Cannon.TriggerShot();
- // Skip reseting fire interval when this is the last pending fruit
- // since we need it to fire immediately when firing the first fruit of a new wave
- if (FruitsPendingSpawn.Count == 1)
- {
- TimeSinceLastFruitSpawn = 0f;
- }
- }
- else
- {
- // do nothing ,wait for cannon fire animation to finish
- }
- }
- else
- {
- TimeSinceLastFruitSpawn += Time.deltaTime;
- }
- }
- else // No pending spawning fruit
- {
- if (FruitsInField.Count == 0)
- {
- if (MakeNewWaveCountdown > 0)
- {
- MakeNewWaveCountdown -= Time.deltaTime;
- }
- else
- {
- MakeFruitsWave();
- MakeNewWaveCountdown = GamingValues.MakeNewWaveCountdown;
- }
- }
- }
- // update aiming cross position
- if (BowCamera.isTouchMode == false)
- {
- Vector3 raw_screen_pos = Cam.WorldToScreenPoint(Cam.transform.position + (CurrentRotation * Vector3.forward));
- float dist_to_mid_x = (raw_screen_pos.x - ScreenMidPoint.x) * AimingCrossPosMultiplier;
- float dist_to_mid_y = (raw_screen_pos.y - ScreenMidPoint.y) * AimingCrossPosMultiplier;
- Vector3 scrren_pos = new Vector3(Mathf.Clamp((dist_to_mid_x + ScreenMidPoint.x), 0f, 2 * ScreenMidPoint.x), Mathf.Clamp((dist_to_mid_y + ScreenMidPoint.y), 0f, 2 * ScreenMidPoint.y), 1f);
- AimingCross_img.gameObject.GetComponent<RectTransform>().position = scrren_pos;
- }
- // Freeze functionality
- if (bFreeze)
- {
- Time.timeScale = 0.5f;
- bFreezing = true;
- bFreeze = false;
- foreach (var fruit in FruitsInField)
- {
- fruit.GetComponent<FruitBehavior>().Frost();
- }
- }
- if (bFreezing)
- {
- // Freeze visual effect
- float freeze_alpha;
- if (FreezeTimeEclipsed < 0.1f)
- {
- freeze_alpha = Mathf.Lerp(0f, 0.5f, FreezeTimeEclipsed / 0.1f);
- }
- else
- {
- freeze_alpha = Mathf.Lerp(0.5f, 0f, (FreezeTimeEclipsed - 0.1f) / (GamingValues.FreezeTime - 0.1f));
- }
- //MeshRenderer renderer = IceCube.GetComponent<MeshRenderer>();
- //renderer.material.SetFloat("_Cutoff", freeze_alpha);
- Cam.GetComponent<FrostEffect>().FrostAmount = freeze_alpha;
- FreezeTimeEclipsed += (Time.deltaTime / Time.timeScale); // deltaTime is scaled by timeScale, divide it by timeScale will fix it
- if (FreezeTimeEclipsed >= GamingValues.FreezeTime)
- {
- Time.timeScale = 1.0f;
- FreezeTimeEclipsed = 0f;
- bFreezing = false;
- foreach (var fruit in FruitsInField)
- {
- fruit.GetComponent<FruitBehavior>().UnFrost();
- }
- }
- }
- // ComboTime functionality
- if (bEnterComboTime)
- {
- bComboTime = true;
- bEnterComboTime = false;
- ComboTimeEclipsed = 0f;
- }
- if (bComboTime)
- {
- ComboTimeEclipsed += Time.deltaTime;
- if (ComboTimeEclipsed > GamingValues.ComboHitTime)
- {
- bComboTime = false;
- ComboTimeEclipsed = 0f;
- foreach (var f in FruitsInField)
- {
- FruitBehavior fr = f.GetComponent<FruitBehavior>();
- fr.bMoveAlongTrajectory = true;
- }
- FruitVelocityCache_Linear.Clear();
- FruitVelocityCache_Angular.Clear();
- DestroyFruit(ActiveComboPomegarante);
- ActiveComboPomegarante = null;
- }
- else
- {
- foreach (var f in FruitsInField)
- {
- FruitBehavior fr = f.GetComponent<FruitBehavior>();
- fr.bMoveAlongTrajectory = false;
- }
- }
- }
- }
- }
- public void StartGame()
- {
- Debug.Assert(FruitsInField.Count == 0);
- CameraToLook.ins.onParseRotation += UpdateRotation;
- Scores = StartScores;
- ScoreText.text = "Scores : " + Scores;
- Combos = 0;
- MakeNewWaveCountdown = GamingValues.MakeNewWaveCountdown;
- Life = GamingValues.LifeCount;
- UpdateLife(false);
- bGameStarted = true;
- if (true/*bowManager.IsSmartBowConnected()*/)
- {
- AimingCross_img.gameObject.SetActive(true);
- }
- ShowGamingUI(true);
- GamingValues.ResetPomegranateSpawnedCount();
- Cannon.OnCannonFire += SpawnAFruit;
- FruitWaves = 0;
- }
- public void PauseGame()
- {
- bGamePaused = true;
- AimingCross_img.gameObject.SetActive(false);
- Pause_btn.gameObject.SetActive(false);
- Resume_btn.gameObject.SetActive(true);
- Time.timeScale = 0f;
- }
- public void ResumeGame()
- {
- bGamePaused = false;
- AimingCross_img.gameObject.SetActive(true);
- Pause_btn.gameObject.SetActive(true);
- Resume_btn.gameObject.SetActive(false);
- Time.timeScale = 1f;
- }
- public bool IsGameStarted()
- {
- return bGameStarted;
- }
- public bool IsGamePaused()
- {
- return bGamePaused;
- }
- private void MakeFruitsWave()
- {
- // Reset Normal fruit unique funcionality
- FruitTypeList fruit_list = GetComponent<FruitTypeList>();
- Debug.Assert(fruit_list != null);
- fruit_list.ResetUniqueNormalIndex();
- Debug.Assert(FruitsPendingSpawn.Count == 0);
- if (FruitWaves < 5)
- {
- switch (FruitWaves)
- {
- case 0:
- FruitsPendingSpawn.Add(FruitType.Normal);
- break;
- case 1:
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Bomb);
- break;
- case 2:
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Normal);
- break;
- case 3:
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.FrozenBanana);
- break;
- case 4:
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.Normal);
- FruitsPendingSpawn.Add(FruitType.RainbowApple);
- break;
- default:
- break;
- }
- }
- else
- {
- int normal_fruit_count = GamingValues.GetSpawnNum(Scores);
- bool bContain_bomb = GamingValues.DoesSpawnBomb(Scores);
- bool doesSpawnPome = GamingValues.DoesSpawnComboPomegranate(Scores);
- // if spawn FrozenBanana or RainbowApple, 0 - no spawn, 1 - frozen banana, 2 - rainbow apple
- int doesSpawnSpecial = 0;
- int specialAddition = 0;
- if (normal_fruit_count == 3)
- {
- specialAddition++;
- doesSpawnSpecial = 1;
- }
- else if (normal_fruit_count >= 4)
- {
- specialAddition++;
- doesSpawnSpecial = 2;
- }
- else
- {
- doesSpawnSpecial = 0;
- }
- if (doesSpawnPome)
- {
- specialAddition++;
- }
- for (int i = 0; i < normal_fruit_count + specialAddition; i++)
- {
- if (i == 0) // for the first fruit, spawn bomb if a bomb is included
- {
- FruitsPendingSpawn.Add(bContain_bomb ? FruitType.Bomb : FruitType.Normal);
- }
- else if (i == 1 && doesSpawnPome) // for the second, we see if a combo pomegranate is included, since if there is one, the minimum count of fruits is 2
- {
- FruitsPendingSpawn.Add(FruitType.ComboPomegranate);
- }
- else if (i == 2 && doesSpawnSpecial > 0) // the third one is last chance for special fruits, check for frozen banana and rainbow apple, they do not appear at the same time, and if there is one, the minimum count must be above 3
- {
- FruitsPendingSpawn.Add(doesSpawnSpecial == 1 ? FruitType.FrozenBanana : FruitType.RainbowApple);
- }
- else // all special fruits spawning posibility is checked when spawning the first 3 fruits, the rest must be normal
- {
- FruitsPendingSpawn.Add(FruitType.Normal);
- }
- }
- }
- FruitWaves++;
- }
- private void SpawnAFruit()
- {
- float speed_x = Random.Range(-100f, 100f);
- float speed_y = Random.Range(350f, 450f);
- Debug.Assert(FruitsPendingSpawn.Count > 0);
- GameObject newFruit = Instantiate(FruitPrefab, Cannon.GetFiringPoint(), Quaternion.identity);
- FruitBehavior fb = newFruit.GetComponent<FruitBehavior>();
- // Get a random target position with a small random range along x axis and lower half y axis
- Vector3 target = Cam.transform.position + new Vector3(Random.Range(-7f, 7f), Random.Range(-10f, -2f), 0f);
- float fruit_lifetime = GamingValues.GetFruitLifetime(FruitWaves, Scores);
- fb.Init(FruitsPendingSpawn[0], this, Cannon.GetFiringPoint(), target, fruit_lifetime);
- FruitsPendingSpawn.RemoveAt(0);
- fb.OnArrive += AFruitArrived;
- fb.OnHitEvent += OnFruitHit;
- FruitsInField.Add(newFruit);
- }
- private void AFruitArrived(FruitBehavior fb)
- {
- if (fb.GetFruitType() != FruitType.Bomb)
- {
-
- if (UpdateLife(true))
- {
- DelayEndGame(EndGameReason.GameOver, 2f);
- }
- FruitsInField.Remove(fb.gameObject);
- DestroyFruit(fb);
- SpawnStain(fb.JuiceStain, fb.gameObject.transform.position);
- }
- else
- {
- fb.gameObject.transform.position = new Vector3(0f, 0f, 10f);
- DestroyFruit(fb);
- DelayEndGame(EndGameReason.GameOver, 2f);
- }
- }
- private void EndGame(EndGameReason reason)
- {
- Cannon.ResetPos();
- Cannon.OnCannonFire -= SpawnAFruit;
- CameraToLook.ins.onParseRotation -= UpdateRotation;
- // clear all fruits in the field
- foreach (var fruit in FruitsInField)
- {
- Destroy(fruit);
- }
- FruitsInField.Clear();
- if (IsGamePaused())
- {
- ResumeGame();
- }
- bGameStarted = false;
- ShowGamingUI(false);
- OnGameEnd.Invoke(reason, Scores);
- }
- private void DelayEndGame(EndGameReason reason, float wait_secs)
- {
- StartCoroutine(DelayEndGame_CR(reason, wait_secs));
- }
- private IEnumerator DelayEndGame_CR(EndGameReason reason, float wait_secs)
- {
- yield return new WaitForSeconds(wait_secs);
- EndGame(reason);
- }
- public static void DelayDestroy(MonoBehaviour excutor, GameObject to_destroy, float wait_secs)
- {
- excutor.StartCoroutine(DelayDestroy_CR(to_destroy, wait_secs));
- }
- private static IEnumerator DelayDestroy_CR(GameObject to_destroy, float wait_secs)
- {
- yield return new WaitForSeconds(wait_secs);
- if (to_destroy)
- Destroy(to_destroy);
- }
- public void ExitGame()
- {
- EndGame(EndGameReason.UserExit);
- }
- private void FireArrow(float speed, Vector3 dir)
- {
- if (bGameStarted && !bGamePaused && FireCooldownTime_Current == 0f)
- {
- FireCooldownTime_Current = FireCooldownTime;
- Vector3 spawnPos = Cam.transform.position + dir;
- GameObject arrow = Instantiate(ArrowPrefab, spawnPos, Quaternion.FromToRotation(-Vector3.right, dir));
- arrow.GetComponent<ArrowBehavior>().Init(speed, dir, true);
- arrow.GetComponent<ArrowBehavior>().OnMissShoot += MissShoot;
- BowFireAudio.clip = audioManager.GetRandomSound(SoundCategory.ArrowFire);
- BowFireAudio.Play();
- }
- }
- private void SmartBowFireArrow(float speed)
- {
- if (Time.time == 0) return;
- if (IsGameStarted())
- {
- if (IsGamePaused()) // if game is paused, fire the smart bow will resume game
- {
- ResumeGame();
- }
- else // If game is started and not paused, shoot a arrow
- {
- Vector3 direction = Cam.ScreenToWorldPoint(AimingCross_img.GetComponent<RectTransform>().position);
- FireArrow(speed * ArrowSpeedMultiplier, direction);
- }
- }
- else
- {
- gameObject.GetComponent<OverallLogics>().StartGame();
- }
- }
- private void UpdateRotation(Quaternion q)
- {
- CurrentRotation = q;
- }
- private void MouseFireArrow(Vector3 screenPos)
- {
- Vector3 worldPos = Cam.ScreenToWorldPoint(new Vector3(screenPos.x, screenPos.y, 10.0f));
- FireArrow(20.0f, worldPos - Cam.transform.position);
- }
- private void OnFruitHit(FruitBehavior fb, Vector3 hitPoint, bool bCritical)
- {
- Combos++;
- // if this is a ComboPomegranate, ignore critical and combo hit, only gain 1 score per hit
- if (fb.GetFruitType() == FruitType.ComboPomegranate)
- {
- if (GainScore(1))
- {
- UpdateLife(false);
- }
- }
- else if (bCritical)
- {
- if (GainScore(10))
- {
- UpdateLife(false);
- }
- // display a critical text
- GameObject critical = Instantiate(CriticalTextPrefab, GamingUIContainer.transform);
- critical.transform.position = Cam.WorldToScreenPoint(hitPoint);
- }
- else if (Combos > 1) // This combo section handles combo scores addition, text displaying is handled after
- {
- if (GainScore(5))
- {
- UpdateLife(false);
- }
- }
- else // A very bland hit, no critical, no combo
- {
- if (GainScore(5))
- {
- UpdateLife(false);
- }
- }
- if (Combos > 1) // This combo section handles combo text display
- {
- // display a combo text
- GameObject combo = Instantiate(ComboTextPrefab, GamingUIContainer.transform);
- combo.GetComponent<ComboTextBehavior>().SetComboNumber(Combos);
- }
- if (fb.GetFruitType() == FruitType.FrozenBanana)
- {
- // enter freeze state
- bFreeze = true;
- FreezeTimeEclipsed = 0.0f;
- DestroyFruit(fb);
- }
- else if (fb.GetFruitType() == FruitType.ComboPomegranate)
- {
- ComboPomegaranteBehavior cpb = fb.gameObject.GetComponent<ComboPomegaranteBehavior>();
- if (cpb.GetHitCount() == 0)
- {
- bEnterComboTime = true;
- ActiveComboPomegarante = fb;
- foreach (var f in FruitsInField)
- {
- FruitVelocityCache_Linear.Add(f.gameObject.GetComponent<Rigidbody>().velocity);
- FruitVelocityCache_Angular.Add(f.gameObject.GetComponent<Rigidbody>().angularVelocity);
- }
- }
- cpb.Hit();
- if (cpb.GetHitCount() >= GamingValues.ComboHitLimit)
- {
- bComboTime = false;
- DestroyFruit(fb);
- ActiveComboPomegarante = null;
- ComboTimeEclipsed = 0f;
- foreach (var f in FruitsInField)
- {
- FruitBehavior fr = f.GetComponent<FruitBehavior>();
- fr.bMoveAlongTrajectory = true;
- }
- }
- else
- {
- // do nothing
- }
- }
- else if (fb.GetFruitType() == FruitType.RainbowApple)
- {
- Instantiate(FullscreenClearBubble, fb.gameObject.transform.position, Quaternion.identity);
- DestroyFruit(fb);
- }
- else
- {
- DestroyFruit(fb);
- }
- }
- /// <summary>
- /// Gain some scores
- /// </summary>
- /// <returns> If exceeded another 100 scores, return true, for life recovering test </returns>
- private bool GainScore(int score)
- {
- int last_scores = Scores;
- Scores += score;
- ScoreText.text = "Scores : " + Scores; // update socres display
- return ((Scores / 100) == (last_scores / 100) + 1);
- }
- /// <summary>
- /// Add or substract life point by 1
- /// </summary>
- /// <param name="bDecrease">true for decrease, false for add</param>
- /// <returns>return true if life reaches 0</returns>
- private bool UpdateLife(bool bDecrease)
- {
- if (bDecrease)
- {
- Life--;
- if (Life < 0)
- {
- Life = 0;
- }
- LooseLifeAudio.Play();
- }
- else
- {
- if (Life < 3)
- {
- Life++;
- GameObject addLife = Instantiate(AddLifeTextPrefab, GamingUIContainer.transform);
- }
- }
- switch (Life)
- {
- case 0:
- Life_0_img.gameObject.SetActive(true);
- Life_1_img.gameObject.SetActive(true);
- Life_2_img.gameObject.SetActive(true);
- return true;
- case 1:
- Life_0_img.gameObject.SetActive(true);
- Life_1_img.gameObject.SetActive(true);
- Life_2_img.gameObject.SetActive(false);
- return false;
- case 2:
- Life_0_img.gameObject.SetActive(true);
- Life_1_img.gameObject.SetActive(false);
- Life_2_img.gameObject.SetActive(false);
- return false;
- case 3:
- Life_0_img.gameObject.SetActive(false);
- Life_1_img.gameObject.SetActive(false);
- Life_2_img.gameObject.SetActive(false);
- return false;
- default:
- return false;
- }
- }
- private void MissShoot()
- {
- Combos = 0;
- }
- private void ShowGamingUI(bool b)
- {
- GamingUIContainer.SetActive(b);
- }
- public void DestroyFruit(FruitBehavior fb)
- {
- FruitsInField.Remove(fb.gameObject);
- fb.SmashEffect();
- }
- public AudioManager GetAudioManager()
- {
- return audioManager;
- }
- public void SpawnStain(Sprite stain, Vector3 position3d_ws)
- {
- GameObject stain_go = Instantiate(new GameObject(), GamingUIContainer.transform);
- stain_go.AddComponent<Image>().sprite = stain;
- stain_go.transform.position = Cam.WorldToScreenPoint(position3d_ws);
- stain_go.transform.localScale = Vector3.one * 8f;
- stain_go.AddComponent<StainBehaviour>();
- }
- }
|