示例#1
0
    // Start is called before the first frame update
    private void OnTriggerEnter(Collider other)
    {
        GameObject triggeringObj;

        triggeringObj = other.gameObject;
        if (triggeringObj.tag == "DeadTurkey")
        {
            GameObject GlobalPrompt;                            //This block gets the reference
            Text       TextObj;                                 //to the object to hold the
            GlobalPrompt = GameObject.Find("GlobalPrompt");     //game won text and inserts
            TextObj      = GlobalPrompt.GetComponent <Text>();  //the game won text
            TextObj.text = "WINNER WINNER TURKEY DINNER!";
            Invoke("QuitApplication", 4.0f);                    //close application in 4 seconds
        }
    }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.H))                         //if the h key is pressed
     {
         GameObject GlobalPrompt;                             //This block gets the reference
         Text       TextObj;                                  //to the text object to hold
         GlobalPrompt = GameObject.Find("GlobalPrompt");      //the help text and inserts
         TextObj      = GlobalPrompt.GetComponent <Text>();   //the text for display
         TextObj.text = "Goal: Get Revenge On The Turkey\n" + //
                        "Controls:\n" +                       //
                        "Move: Arrow Keys/WASD\n" +           //
                        "Look: Mouse\n" +                     //
                        "Buy Weapon: 1, 2, 3\n" +             //
                        "Use Weapon: Space";                  //
     }
     else if (Input.GetKeyUp(KeyCode.H))                      //if the h key is released
     {
         GameObject GlobalPrompt;                             //This block gets the reference
         Text       TextObj;                                  //to the text object holding
         GlobalPrompt = GameObject.Find("GlobalPrompt");      //the help text and removes
         TextObj      = GlobalPrompt.GetComponent <Text>();   //the text from the screen
         TextObj.text = "";                                   //
     }
 }