예제 #1
0
    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;
            }
        }
    }