예제 #1
0
    void OnTriggerEnter(Collider collider)
    {
        // check if it can collide with the slot
        if (!isUsed && collider.tag == "Trophy")
        {
            // get the trophy
            Trophy trophy = collider.gameObject.GetComponent <Trophy>();

            // make it used
            isUsed = true;

            trophy.LockTrophy();

            connectedTrophy_ = trophy;

            ClampTrophy();

            // fill a slot in the shelf
            trophyShelf_.SlotFilled();

            Color previousColor = outlineRenderer_.material.GetColor("_Color");

            if (trophy.IsClean())
            {
                SoundManager.PlaySFX(SoundManager.SFX.kCompletedGood);

                Color newColor = Color.green;
                newColor.a = previousColor.a;
                outlineRenderer_.material.SetColor("_Color", newColor);
            }
            else
            {
                SoundManager.PlaySFX(SoundManager.SFX.kCompletedBad);

                Color newColor = Color.red;
                newColor.a = previousColor.a;
                outlineRenderer_.material.SetColor("_Color", newColor);
            }
        }
    }