Skip to content
Snippets Groups Projects
Select Git revision
  • feat/game-statistics
  • main default protected
  • dev
  • feat/android
  • feat/pet
  • feat/cheats-and-orbs
  • refactor/cutscene
  • feat/shop
  • feat/statistics
  • feat/story-mode
  • feat/menu
  • feats/quests
  • feat/weapons-and-mobs
  • feat/game-over
  • v1.1
  • v1.0
16 results

Physics2DSettings.asset

Blame
  • ShopColliderDetection.cs 1019 B
    using UnityEngine;
    using TMPro;
    using System.Collections;
    
    public class ColliderChecker : MonoBehaviour
    {
        public GameObject shopKeeper;
        public Canvas shopInstructionCanvas;
        public TMP_Text instructionText;
        public SaveRadius saveRadius;
    
        void Update()
        {
            // Check if the targetObject is within the collider of this GameObject
            if (!GetComponent<Collider>().bounds.Intersects(shopKeeper.GetComponent<SphereCollider>().bounds))
            {
                if ((Input.GetKeyDown(KeyCode.Z) || Input.GetButton("X Button")) && Time.timeScale == 1 && !saveRadius.playerInRange)
                {
                    StartCoroutine(ErrorMessage());
                }
            }
        }
    
        IEnumerator ErrorMessage()
        {
            instructionText.text = "Shop is out of range";
            shopInstructionCanvas.gameObject.SetActive(true);
    
            yield return new WaitForSeconds(2f);
    
            shopInstructionCanvas.gameObject.SetActive(false);
            instructionText.text = "Press Z to open the shop";
        }
    }