public void CollisionDetected(string tagName, GameObject collidedGameObject) { Debug.Log(tagName); if (tagName == "Key") { this.playerKeyCount++; } if (tagName == "Chest") { ChestController cc = collidedGameObject.GetComponent <ChestController>(); if (this.playerKeyCount >= KEY_COUNT_PER_CHEST && !cc.isUnlocked) { cc.Unlock(); this.playerKeyCount -= KEY_COUNT_PER_CHEST; } } if (tagName == "Diamond") { DiamondController dc = collidedGameObject.GetComponent <DiamondController>(); this.playerDiamondCount += dc.value; if (this.playerDiamondCount > 999) { this.playerDiamondCount = 999; } } }
private void Initialize() { newHeartController = FindObjectOfType <NewHeartController>(); diamondController = FindObjectOfType <DiamondController>(); afterPurchaseEffectController = FindObjectOfType <AfterPurchaseEffectController>(); heartShopController = FindObjectOfType <HeartShopController>(); UIController = FindObjectOfType <UIController>(); }
private void Initialize() { body = afterPurchaseEffectCanvas.transform.GetChild(0); diamondController = FindObjectOfType <DiamondController>(); levelLoader = FindObjectOfType <LevelLoader>(); productController = FindObjectOfType <ProductController>(); effectText = body.GetComponentInChildren <Text>(); effectImage = body.GetChild(4).gameObject; }
private void Initialize() { levelLoader = FindObjectOfType <LevelLoader>(); diamondController = FindObjectOfType <DiamondController>(); itemController = FindObjectOfType <ItemController>(); afterPurchaseEffectController = FindObjectOfType <AfterPurchaseEffectController>(); popupController = FindObjectOfType <PopupController>(); itemShopCanvas.panelSetting.onClick.AddListener(() => ToggleItemShopCanvas(false)); closeButton.onClick.AddListener(() => ToggleItemShopCanvas(false)); ToggleItemShopCanvas(false); }
private void Initialize() { levelLoader = FindObjectOfType <LevelLoader>(); newHeartController = FindObjectOfType <NewHeartController>(); diamondController = FindObjectOfType <DiamondController>(); itemController = FindObjectOfType <ItemController>(); afterPurchaseEffectController = FindObjectOfType <AfterPurchaseEffectController>(); resetDiceController = FindObjectOfType <ResetDiceController>(); productController = FindObjectOfType <ProductController>(); currentLevelNumber = levelLoader.GetCurrentLevelNumber(); savedLevelStarCount = PlayerPrefs.GetInt($"LevelStar {currentLevelNumber}"); levelCleared = PlayerPrefs.GetInt($"Level {currentLevelNumber}"); }
private void Initialize() { levelLoader = FindObjectOfType <LevelLoader>(); UIController = FindObjectOfType <UIController>(); iAPManager = FindObjectOfType <IAPManager>(); newHeartController = FindObjectOfType <NewHeartController>(); diamondController = FindObjectOfType <DiamondController>(); diamondShopController = FindObjectOfType <DiamondShopController>(); afterPurchaseEffectController = FindObjectOfType <AfterPurchaseEffectController>(); popupController = FindObjectOfType <PopupController>(); heartShopSiblingIndex = transform.GetSiblingIndex(); Debug.Log(heartShopSiblingIndex + ":heartShopSiblingIndex"); }
private void DestroyAt(Vector2 direction) { Vector3 pos = new Vector3(direction.x, direction.y, -3) + transform.position; RaycastHit2D hit = Physics2D.Raycast(pos, Vector2.zero); if (hit) { DiamondController diamond = hit.transform.GetComponent <DiamondController>(); if (diamond) { diamond.DestroyDiamond(value); } } }
void Awake() { if (levelLoader == null) { levelLoader = FindObjectOfType <LevelLoader>(); } if (diceController == null) { diceController = FindObjectOfType <DiceController>(); } if (blockController == null) { blockController = FindObjectOfType <BlockController>(); } if (itemController == null) { itemController = FindObjectOfType <ItemController>(); } if (noDiceNoCoinController == null) { noDiceNoCoinController = FindObjectOfType <NoDiceNoCoinController>(); } if (speicalBlockController == null) { speicalBlockController = FindObjectOfType <SpeicalBlockController>(); } if (statisticsController == null) { statisticsController = FindObjectOfType <StatisticsController>(); } if (resetDiceController == null) { resetDiceController = FindObjectOfType <ResetDiceController>(); } if (uiController == null) { uiController = FindObjectOfType <UIController>(); } if (heartShopController == null) { heartShopController = FindObjectOfType <HeartShopController>(); } if (itemShopController == null) { itemShopController = FindObjectOfType <ItemShopController>(); } if (diamondShopController == null) { diamondShopController = FindObjectOfType <DiamondShopController>(); } if (startController == null) { startController = FindObjectOfType <StartController>(); } if (newHeartController == null) { newHeartController = FindObjectOfType <NewHeartController>(); } if (diamondController == null) { diamondController = FindObjectOfType <DiamondController>(); } if (iAPManager == null) { iAPManager = FindObjectOfType <IAPManager>(); } if (rewardController == null) { rewardController = FindObjectOfType <RewardController>(); } if (this.name != Constants.GAME_OBJECT_NAME.STAGE.CLONED_BLOCK) { cameraShakersForPlate = FindObjectsOfType <CameraShaker>(); } _initialize(); }