예제 #1
0
 // Use this for initialization
 void Start()
 {
     lives        = 5;
     inputHandler = GetComponent <InputHandlerScript>();
     scoreManager = managerObject.GetComponent <ScoreManager>();
     nextButton   = null;
     secondButton = null;
 }
 void Awake()
 {
     if(input == null){
         DontDestroyOnLoad (gameObject);
         input = this;
     }
     else
     {
         Destroy (gameObject);
     }
 }
 // Use this for initialization
 void Start()
 {
     //this gets the god of war object
     animationManager = GameObject.Find ("Tumatauenga");
     ////this gets the script that handles the animation
     animation = animationManager.GetComponent<Animation>();
     //this get the audio manager object
     audioManager = GameObject.Find ("AudioManager");
     //this get the script that handle the changing of the audio files
     audio = audioManager.GetComponent<InputHandlerScript>();
     //this get the audio manager object
     audioTumatauenga = GameObject.Find ("Tumatauenga");
     //this get the controls the audio for the haka
     tumatauengaAudioSource = audioTumatauenga.GetComponent<AudioSource> ();
 }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;
        //this gets a true or false from the raycast component
        bool isLookedAt = GetComponent <Collider> ().Raycast(head.Gaze, out hit, Mathf.Infinity);

        // if looking at object for 2 seconds
        if (isLookedAt && Time.time > delay)
        {
            //this gets the god of war object
            GameObject animationManager = GameObject.Find("Tumatauenga");
            ////this gets the script that handles the animation
            Animation animation = animationManager.GetComponent <Animation>();
            //this plays the animation
            animation.Play();
            //this get the audio manager object
            GameObject audioManager = GameObject.Find("AudioManager");
            //this get the script that handle the changing of the audio files
            InputHandlerScript audio = audioManager.GetComponent <InputHandlerScript>();
            //this changes the audio boolen in InputHandlerScript
            audio.Koauau   = false;
            audio.Putatara = false;
            if (animation["GodOfWarTake1"].enabled && animation["GodOfWarTake1"].time == 0)
            {
                audio.Haka = true;
            }
            else
            {
                audio.Haka = false;
            }
            //this line set the delay to count down
            delay = Time.time + delayTime;
        }
        // currently looking at object
        else if (isLookedAt)
        {
        }
        // not looking at object
        else if (!isLookedAt)
        {
            //this line set the delay to count down
            delay = Time.time + delayTime;
        }
    }