// Use this for initialization
    void Start()
    {
        if (myOrgan == null)
        {
            myOrgan = SoundPuzzleOrgan.instance;
        }
        if (myOrgan == null)
        {
            Debug.Log(gameObject.name + " " + this.name
                      + ":'Lonely, i feel so lonely... i've got no Organ to play with me!'");
        }

        /*
         * if (audioSource == null)
         *  audioSource = GetComponent<AudioSource>();
         * if (audioSource == null)
         *  Debug.Log(gameObject.name + " " + this.name
         + ":'Lonely, i feel so lonely... i've got no AudioSource to play with me!'");
         */

        if (solver == null)
        {
            Debug.Log(gameObject.name + " " + this.name
                      + ":'Give me a SoundPuzzleBridgeManager ...'");
        }
    }
    protected void Setup()
    {
        if (pipeOrgan == null)
        {
            pipeOrgan = SoundPuzzleOrgan.instance;
        }
        if (pipeOrgan == null)
        {
            Debug.Log(gameObject.name + " " + this.name
                      + ":'Lonely, i feel so lonely... i've got no Organ to play with me!'");
        }

        if (quizMaster == null)
        {
            quizMaster = SoundPuzzleRiddler.instance;
        }
        if (quizMaster == null)
        {
            Debug.Log(gameObject.name + " " + this.name
                      + ":'Lonely, i feel so lonely... i've got no Riddler to play with me!'");
        }

        nextDeafDuration = minDontReactSeconds;

        if (transform.childCount > 0)
        {
            unpressedPosition  = transform.GetChild(0).localPosition;
            pressedPosition    = unpressedPosition;
            pressedPosition.y += pressedDownOffset;
        }
    }
Example #3
0
    /// <summary>
    /// moves camera
    /// </summary>
    /// <param name="songID">amount of sounds in melody?</param>
    public void LockAndMove(int songID, SoundPuzzleOrgan organ)
    {
        mySong  = songID;
        myOrgan = organ;
        if (viewTarget == null)
        {
            viewTarget = myOrgan.transform;
        }
        organ.songEnded += MelodyEnded;

        if (cam == null)
        {
            if (cameraMinMoveDuration > cameraMaxMoveDuration)
            {
                Debug.LogWarning(gameObject.name + ": Min < Max, du Otto!");
                cameraMinMoveDuration = cameraMaxMoveDuration;
            }
            cam       = GameObject.FindWithTag("MainCamera");
            camScript = cam.gameObject.GetComponent <Cameras>();
            //if (viewTarget == null)
            //    viewTarget = GameObject.Find(defaultTargetName).transform;
            playerTransform = GameObject.FindWithTag(StringCollection.TAG_PLAYER).transform;
            moveScript      = playerTransform.GetComponent <MovementScript>();
        }

        camScript.enabled = false;
        moveScript.cameraAnimationLocked = true;
        moveScript.StopWalking();
        StartCoroutine(CameraShift());
    }
Example #4
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.Log("Two " + this.name + "s " + instance.gameObject.name + "/" + this.gameObject.name);
     }
     instance = this;
 }
Example #5
0
 /// <summary>
 /// call this at the start of every subclass!
 /// </summary>
 protected void Setup()
 {
     if (pipeOrgan == null)
     {
         pipeOrgan = SoundPuzzleOrgan.instance;
     }
     if (pipeOrgan == null)
     {
         Debug.Log(gameObject.name + " " + this.name
                   + ":'Lonely, i feel so lonely... i've got no Organ to play with me!'");
     }
     else
     {
         pipeOrgan.singleNote += HearedSound;
     }
 }
Example #6
0
    public void RepairBridge()
    {
        Debug.Log(gameObject.name + ": Did it!");
        if (!ignoreAnimation)
        {
            myAnimator.SetTrigger("BuildUp");
            if (barrier)
            {
                barrier.SetActive(false);
            }
        }
        else
        {
            StartCoroutine(MoveUp());
        };
        solved = true;

        //Debug.Log(startMelodyWithRepair + " " + pipeOrgan + " " + melodyID + " " + cameraMove);
        if (startMelodyWithRepair)
        {
            if (pipeOrgan == null)
            {
                pipeOrgan = SoundPuzzleOrgan.instance;
            }
            if (pipeOrgan != null)
            {
                //pipeOrgan.PlayMelodyInstant(melodyID);
                pipeOrgan.PlayOrAddToWaitingList(melodyID);
            }
        }
        if (playAudioSource)
        {
            AudioSource a = GetComponent <AudioSource>();
            if (a != null)
            {
                a.Play();
            }
        }
        if (cameraMove)
        {
            cameraMove.LockAndMoveCamera();
        }
        if (nextSegment)
        {
            StartCoroutine(DelayedNextSegment(nextSegmentDelay));
        }
    }