Пример #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         levMan.GetComponent <LevelBuilder>().levelTreasures.Remove(gameObject);
         cMan.AddToScore(myWorth);
         Destroy(gameObject);
     }
 }
    void Update()
    {
        //While the player is trying to solve the puzzle...
        if (solveState == puzzleState.inProgress)
        {
            //Stop the player moving (because I may be using the same inputs and/or moving the mouse)
            pMove.allowMove = false;
        }
        else
        {
            if (solveState == puzzleState.unsolved)
            {
                print("Puzzle Left Unsolved");
                this.enabled = false;
            }
            else if (solveState == puzzleState.solved)
            {
                //Remove this display case's treasure from the list of acquired treasures/pickups
                levMan.GetComponent <LevelBuilder>().levelTreasures.Remove(myTreasure);
                Destroy(myTreasure);
                cMan.AddToScore(myWorth);

                Destroy(this);
            }
            else if (solveState == puzzleState.failed)
            {
                LevelManager.timerState = LevelManager.TimerOn.timerActivated;
                Destroy(this);
            }

            pMove.allowMove = true;

            if (isTimerActive == "timerActivated")
            {
                LevelManager.timerState = LevelManager.TimerOn.timerActivated;
            }
        }
    }