コード例 #1
0
    PhoneScript SpawnPhone(Transform originalList)
    {
        List <Transform> list = new List <Transform>();

        foreach (Transform child in originalList)
        {
            if (!child.gameObject.activeSelf && Vector3.Distance(player.position, child.position) > 6.0f)
            {
                list.Add(child);
            }
        }
        Transform val;

        if (list.Count == 0)
        {
            while (true)
            {
                val = originalList.GetChild(Random.Range(0, originalList.childCount - 1));
                if (!val.gameObject.activeSelf)
                {
                    break;
                }
            }
        }
        else
        {
            val = list[Random.Range(0, list.Count - 1)];
        }
        Destroy(val.gameObject);
        PhoneScript val2 = Instantiate(phonePrefab, val.position, val.rotation, originalList);

        return(val2);
    }
コード例 #2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         phone = GameObject.Find("Canvas");
         PhoneScript phonescript = phone.GetComponent <PhoneScript>();
         phonescript.removeTask(indexOrder);
         this.gameObject.SetActive(false);
     }
 }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     onCall              = false;
     callIncoming        = false;
     alertCanvas.enabled = false;
     ringing             = "Answer Your Phone!";
     script              = "Call script:\nHello, and thank you for calling Bizee.Com. My name is [Your Name]. How may I help you?";
     r         = GetComponent <SpriteRenderer>();
     r.enabled = false;
     S         = this;
 }
コード例 #4
0
    void Start()
    {
        cameraP   = GameObject.Find("Camera");
        camScript = cameraP.GetComponent <CameraControl>();

        phone       = GameObject.Find("phone");
        phoneScript = phone.GetComponent <PhoneScript>();

        computer = GameObject.Find("Computer");

        directCamera(computer);
        sfx = transform.GetComponent <AudioSource>();
    }
コード例 #5
0
 private void OnEnable()
 {
     start = transform.position;
     for (int i = 1; i <= 350; ++i)
     {
         float randX = Random.Range(0, radius);
         float randY = Random.Range(0, radius);
         float randZ = Random.Range(0, radius);
         if (i % 2 == 0)
         {
             randX *= -1;
             randY *= -1;
             randZ *= -1;
         }
         Vector3 vec = new Vector3(randX, randY, randZ);
         randX = Random.Range(0.0f, 359.99f);
         randY = Random.Range(0.0f, 359.99f);
         randZ = Random.Range(0.0f, 359.99f);
         Vector3     vec2  = new Vector3(randX, randY, randZ);
         Transform   trans = transform.GetChild(0).GetChild(i % 5);
         PhoneScript phone = Instantiate(phonePrefab, trans, false);
         phone.transform.localPosition = vec;
         phone.transform.localRotation = Quaternion.Euler(vec2);
         Destroy(phone.GetComponent <BoxCollider>());
         Destroy(phone.GetComponent <Rigidbody>());
         int j = 0;
         if (i % 2 == 0)
         {
             j = 1;
         }
         else if (i % 3 == 0)
         {
             j = 2;
         }
         phone.ringType = j;
         float ting = Random.Range(0.0f, PhoneScript.ringLength);
         phone.timer    = ting;
         phone.src.time = ting;
     }
     k = 0;
 }
コード例 #6
0
    IEnumerator waitTask()
    {
        int taskCounter = 0;

        while (taskCounter < Tasks.Length)
        {
            yield return(new WaitForSeconds(0.01f));

            randTask = Random.Range(0, Tasks.Length);
            PhoneScript phonescript = phone.GetComponent <PhoneScript>();
            phonescript.addTask(taskTime, todo[taskCounter]);
            Vector3 spawnPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));
            temp = Instantiate(Tasks[randTask], spawnPosition + transform.TransformPoint(0, 0, 0), gameObject.transform.rotation);

            temp.SetActive(true);



            //yield return new WaitForSeconds(0.01f);
            taskCounter++;
        }
    }
コード例 #7
0
    IEnumerator Phase3()
    {
        playerLight.gameObject.SetActive(false);
        powerDown.Play();
        int i = 0;

        ring2.Play();
        foreach (Transform child in tempPhase3Phones)
        {
            PhoneScript phone = Instantiate(phonePrefab, child.position, child.rotation, phase3Phones);
            Destroy(phone.GetComponent <Rigidbody>());
            Destroy(phone.GetComponent <AudioSource>());
            phone.name     = child.name;
            phone.ringType = i++;
            if (i > 2)
            {
                i = 0;
            }
            if (child.localPosition.y > 2.9f)
            {
                Destroy(phone.GetComponent <BoxCollider>());
            }
        }
        Destroy(tempPhase3Phones.gameObject);
        StartCoroutine(Wait(ring2.clip.length));
        while (waiting)
        {
            yield return(null);
        }
        phase3Phones.gameObject.SetActive(true);
        music[9].Play();
        playerLight.gameObject.SetActive(true);
        playerLight.range     = 9.89f;
        playerLight.intensity = 2.01f;
        spotlight.Play();
        ring2.Play();
    }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     playerPhone = GameObject.Find("Phone").GetComponent <PhoneScript>();
     flashlight  = gameObject.GetComponent <Light>();
 }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     phone = GameObject.Find ("Phone");
     ps = phone.GetComponent<PhoneScript> ();;
 }
コード例 #10
0
    IEnumerator Phase5()
    {
        phase5       = true;
        holdingPhone = false;
        startPhase5  = false;
        StartCoroutine(FinalPhone());
        while (finalPhone)
        {
            yield return(null);
        }
        bassDrop.Play();
        StartCoroutine(SlowZoom());
        while (bassDrop.isPlaying)
        {
            if (paused)
            {
                yield return(new WaitForSeconds(0.1f));
            }
            yield return(null);
        }
        cam.backgroundColor = new Color(159.0f / 255.0f, 96 / 255.0f, 190.0f / 255.0f, 255f);
        house2 = GameObject.Find("House 2");
        while (zooming)
        {
            yield return(null);
        }
        float spacer = 250;
        int   bound  = 4;

        for (int i = -bound; i < bound; ++i)
        {
            for (int j = -bound; j < bound; ++j)
            {
                for (int k = -bound; k < bound; ++k)
                {
                    PhoneScript ps = Instantiate(phonePrefab, new Vector3(i * spacer, j * spacer, k * spacer), Quaternion.identity,
                                                 phase5Phones.transform);
                    Destroy(ps.GetComponent <BoxCollider>());
                    ps.GetComponent <AudioSource>().volume = 0.0f;
                    Destroy(ps.GetComponent <Rigidbody>());
                    ps.transform.localScale = new Vector3(500, 500, 500);
                }
            }
        }
        music[10].Play();
        phase5Lights.SetActive(false);
        floatingLights.SetActive(true);
        player.position = playerEndStart;
        controller.m_MouseLook.m_CameraTargetRot    = new Quaternion(-0.1f, 0.0f, 0.0f, 1.0f);
        controller.m_MouseLook.m_CharacterTargetRot = new Quaternion(0.0f, -179.9f, 0.0f, -4.4f);
        phase5Phones.SetActive(true);
        controller.enabled = true;
        StopCoroutine(SlowZoom());
        cam.fieldOfView = 60.0f;
        StartCoroutine(FloatPlayer());
        house2.SetActive(false);
        godPhone.gameObject.SetActive(false);
        StartCoroutine(Wait(13.0f));
        while (waiting)
        {
            yield return(null);
        }
        foreground.gameObject.SetActive(true);
        StartCoroutine(Wait(7.0f));
        while (waiting)
        {
            yield return(null);
        }
        SceneManager.LoadScene("Menu");
    }
コード例 #11
0
    IEnumerator HandlePhoneInteraction(GameObject phone)
    {
        currReceiver  = phone.transform.GetChild(0);
        receiverNoise = currReceiver.GetComponent <AudioSource>();
        receiverPos   = currReceiver.position;
        currReceiver.localRotation = new Quaternion(0, 0, 0, currReceiver.localRotation.w);
        receiverRot = currReceiver.rotation;
        PhoneScript   phoneTing = phone.GetComponent <PhoneScript>();
        int           ringType  = -1;
        StringBuilder fileName  = new StringBuilder("Sounds/");

        if (phoneTing != null)
        {
            if (phase1Phones != null)
            {
                if (phonesPickedUp > 1)
                {
                    StartCoroutine(LowerPhase1Music());
                }
                switch (phonesPickedUp)
                {
                case 0:
                    fileName.Append("dial tone");
                    break;

                case 1:
                    fileName.Append("off hook");
                    break;

                case 2:
                    fileName.Append("beep");
                    break;

                case 3:
                    fileName.Append("interference");
                    break;

                case 4:
                    fileName.Append("orchestra");
                    break;

                case 5:
                    fileName.Append("office");
                    break;

                case 6:
                    fileName.Append("chair");
                    break;

                case 7:
                    fileName.Append("beach");
                    break;

                case 8:
                    fileName.Append("wahwah");
                    break;

                case 9:
                    fileName.Append("this is");
                    break;
                }
            }
            else if (phase3Phones != null && phase3Phones.gameObject.activeSelf)
            {
                ringType = phoneTing.ringType;
                StartCoroutine(LowerPhase3Music());
                StartCoroutine(LowerRing2());
                if (String.Compare(phone.name, "God Phone") != 0 && ringType == 0)
                {
                    StringBuilder temp = new StringBuilder("correct ");
                    temp.Append((numPhase3Phones + 1).ToString());
                    fileName.Append(temp.ToString());
                }
                else
                {
                    fileName.Append("wrong");
                }
            }
            else if (startPhase2)
            {
                fileName.Append("this is");
            }
            else if (startPhase3)
            {
                fileName.Append("glitch");
            }
            else if (startPhase4)
            {
                fileName.Append("swarm");
            }
            else if (startPhase5)
            {
                fileName.Append("good bye");
            }
        }
        StartCoroutine(HoldPhone(phone, fileName.ToString()));
        while (holdingPhone)
        {
            yield return(null);
        }
        if (phase1Phones != null)
        {
            StartCoroutine(UnlowerPhase1Music());
        }
        else if (phase3Phones != null && phase3Phones.gameObject.activeSelf)
        {
            StartCoroutine(UnlowerPhase3Music());
            StartCoroutine(UnlowerRing2());
        }
        if (!phoneTing.enabled || !pickedUp)
        {
            yield break;
        }
        phoneTing.enabled = false;
        if (startPhase2)
        {
            StartCoroutine(Phase2());
            startPhase2 = false;
        }
        else if (startPhase3)
        {
            startPhase3 = false;
            StartCoroutine(Phase3());
        }
        else if (phase3Phones != null && phase3Phones.gameObject.activeSelf)
        {
            if (ringType == 0 && String.Compare(phone.name, "God Phone") != 0)
            {
                phoneTing.ringType = -1;
                if (++numPhase3Phones < 5)
                {
                    yield break;
                }
                StartCoroutine(FadeOutPhase3Music());
                foreach (Transform child in phase3Phones)
                {
                    child.GetComponent <PhoneScript>().enabled = false;
                    BoxCollider bc = child.GetComponent <BoxCollider>();
                    if (bc != null)
                    {
                        bc.enabled = false;
                    }
                }
                StartCoroutine(FadeLight(false));
                ring2.Stop();
                powerDown.Play();
                StartCoroutine(Wait(25.0f));
                while (waiting)
                {
                    yield return(null);
                }
                StartCoroutine(FadeLight(true));
                playerLight.range = 3.31f;
                startPhase4       = true;
                Destroy(phase3Phones.gameObject);
                ActivateGodPhone();
            }
            else
            {
                numPhase3Phones = 0;
                foreach (Transform child in phase3Phones)
                {
                    PhoneScript ps = child.GetComponent <PhoneScript>();
                    if (!ps.enabled)
                    {
                        foreach (Transform child2 in phase3Phones)
                        {
                            if (!child2.GetComponent <PhoneScript>().enabled)
                            {
                                continue;
                            }
                            ps.timer = child2.GetComponent <PhoneScript>().timer;
                            break;
                        }
                        ps.enabled = true;
                        int newRingType = -1;
                        while ((newRingType = Random.Range(0, 2)) == ringType)
                        {
                            continue;
                        }
                        ps.ringType = newRingType;
                    }
                }
            }
        }
        else if (startPhase4)
        {
            phase4Phones.SetActive(true);
            startPhase4 = false;
        }
        else if (phase1Phones != null)
        {
            if (phonesPickedUp > 1 && phonesPickedUp < 8)
            {
                music[phonesPickedUp - 1].Play();
            }
            switch (phonesPickedUp++)
            {
            case 0:
                StartCoroutine(Wait(45.0f));
                break;

            case 1:
                StartCoroutine(Wait(2.0f));
                break;

            case 2:
                StartCoroutine(Wait(0.5f));
                controller.m_WalkSpeed = 2.7f;
                controller.m_HeadBob.VerticalBobRange   = 0.01f;
                controller.m_HeadBob.HorizontalBobRange = 0.01f;
                hangUpSpeed = 1.6f;
                break;

            case 3:
                controller.m_WalkSpeed = 3.0f;
                controller.m_HeadBob.VerticalBobRange   = 0.07f;
                controller.m_HeadBob.HorizontalBobRange = 0.07f;
                hangUpSpeed = 1.7f;
                break;

            case 4:
                controller.m_HeadBob.VerticalBobRange   = 0.09f;
                controller.m_HeadBob.HorizontalBobRange = 0.09f;
                hangUpSpeed = 2.0f;
                break;

            case 5:
                controller.m_HeadBob.VerticalBobRange   = 0.13f;
                controller.m_HeadBob.HorizontalBobRange = 0.13f;
                hangUpSpeed = 2.5f;
                break;

            case 7:
                controller.m_WalkSpeed = 4.0f;
                hangUpSpeed            = 3.0f;
                break;

            case 8:
                for (int i = 0; i < 7; ++i)
                {
                    music[i].Stop();
                }
                startPhase2            = true;
                controller.m_WalkSpeed = 1.4f;
                controller.m_HeadBob.VerticalBobRange   = 0.07f;
                controller.m_HeadBob.HorizontalBobRange = 0.07f;
                hangUpSpeed           = 1.6f;
                playerLight.intensity = 0.0f;
                powerDown.Play();
                Destroy(phase1Phones.gameObject);
                StartCoroutine(Wait(25.0f));
                while (waiting)
                {
                    yield return(null);
                }
                StartCoroutine(DimLight(false));
                ActivateGodPhone();
                music[7].Play();
                yield break;
            }
            while (waiting)
            {
                yield return(null);
            }
            if (phonesPickedUp == 2)
            {
                music[0].Play();
            }
            SpawnPhone(phase1Phones);
        }
    }
コード例 #12
0
 void Awake()
 {
     phoneScriptInstance = this;
 }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     playerDir = PlayerDirection.WalkingInRightDir;
     phone = GameObject.Find ("Phone");
     ps = phone.GetComponent<PhoneScript> ();
 }
コード例 #14
0
    void Start()
    {
        GameObject canvas = GameObject.FindGameObjectWithTag ("PhoneCanvas");
        cs = (CanvasScript) canvas.GetComponent<CanvasScript>();
        cs.ResetAllLines ();

        GameObject phone = GameObject.FindGameObjectWithTag ("Phone");
        ps = (PhoneScript)phone.GetComponent<PhoneScript> ();

        tsc = ps.tsc;
    }
コード例 #15
0
    //selected using alphaInput[alphaInputButtonIndex][alphaInputIndex]
    // Use this for initialization
    void Start()
    {
        alphaInput[0] = new string[] {" "};
        alphaInput [1] = new string[] {".", ",", "'", "\"", "?", "!", ":", ";", "-", "_", "(", ")", "1" };
        alphaInput [2] = new string[] {"a", "b", "c", "A", "B", "C", "2"};
        alphaInput [3] = new string[]{"d", "e", "f", "D", "E", "F", "3"};
        alphaInput [4] = new string[]{"g", "h", "i", "G", "H", "I", "4"};
        alphaInput [5] = new string[]{"j", "k", "l", "J", "K", "L", "5"};
        alphaInput [6] = new string[]{"m", "n", "o", "M", "N", "O", "6"};
        alphaInput [7] = new string[]{"p", "q", "r", "s", "P", "Q", "R", "S", "7"};
        alphaInput [8] = new string[]{"t", "u", "v", "T", "U", "V", "8"};
        alphaInput [9] = new string[]{"w", "x", "y", "z", "W", "X", "Y", "Z", "9"};

        GameObject canvas = GameObject.FindGameObjectWithTag ("PhoneCanvas");
        cs = (CanvasScript) canvas.GetComponent<CanvasScript>();

        GameObject phone = GameObject.FindGameObjectWithTag ("Phone");
        ps = (PhoneScript)phone.GetComponent<PhoneScript> ();

        m_textArea = "";
        this.enabled = false;
    }