Beispiel #1
0
    void GetRandomOwlie()
    {
        int        owlieNumber = Random.Range(0, 6);
        GameObject tempOwlie   = null;

        switch (owlieNumber)
        {
        case 0: tempOwlie = fullBlink; break;

        case 1: tempOwlie = normal; break;

        case 2: tempOwlie = lookDown; break;

        case 3: tempOwlie = lookLeft; break;

        case 4: tempOwlie = lookUp; break;

        case 5: tempOwlie = lookRight; break;
        }
        if (tempOwlie != null)
        {
            tempOwlie = (GameObject)Instantiate(tempOwlie, currentOwlie.transform.position, Quaternion.identity);
            tempOwlie.GetComponent <OwlieSlider> ().SetTargetY(owlieSlider.GetTargetY());
            owlieSlider = tempOwlie.GetComponent <OwlieSlider> ();
            if (owlieFlapping)
            {
                soundHandler.StopOwlieFlapping();
            }
            Destroy(currentOwlie);
            currentOwlie = tempOwlie;
        }
    }
Beispiel #2
0
    public void OwlieFlap()
    {
        soundHandler.PlayOwlieFlapping();
        GameObject tempOwlie = (GameObject)Instantiate(flapping, currentOwlie.transform.position, Quaternion.identity);

        tempOwlie.GetComponent <OwlieSlider> ().SetTargetY(owlieSlider.GetTargetY());
        owlieSlider   = tempOwlie.GetComponent <OwlieSlider> ();
        owlieFlapping = true;
        Destroy(currentOwlie);
        currentOwlie = tempOwlie;
        currentOwlie.GetComponent <Animator> ().enabled = true;
        cooldown  = Random.Range(1f, 3f);
        timeStamp = Time.time;
    }
Beispiel #3
0
    void LeftEyeHit()
    {
        timeStamp = Time.time;
        cooldown  = Random.Range(.5f, 3.0f);
        GameObject tempOwlie = (GameObject)Instantiate(leftBlink, currentOwlie.transform.position, Quaternion.identity);

        tempOwlie.GetComponent <OwlieSlider> ().SetTargetY(owlieSlider.GetTargetY());
        owlieSlider = tempOwlie.GetComponent <OwlieSlider> ();
        if (owlieFlapping)
        {
            soundHandler.StopOwlieFlapping();
        }
        Destroy(currentOwlie);
        currentOwlie = tempOwlie;
    }
Beispiel #4
0
 public void SetCurrentOwlie(GameObject currentOwlie)
 {
     this.currentOwlie = currentOwlie;
     owlieSlider       = currentOwlie.GetComponent <OwlieSlider> ();
     owlieSet          = true;
 }