Esempio n. 1
0
    //Add by Guanchen Liu
    //Edited by: Jordan Timm (UI modification)
    //Test version
    //This function will decrease the scarePoint of character
    //when light is off. The ghost will eject out if the scarePoint
    //reach 0
    //Bug: The value of scarePoint and lightOn should be recorded by another script
    void scareManager()
    {
        if (scarePoint > 100)
        {
            Nathan.transform.Find("Firefly").gameObject.SetActive(true);
            currentCond = ghostCond.onEjecting;
            //OnLeaving();
            //var otherScript = OtherGhost.GetComponent<GhostController>();
            //otherScript.OnTaking();
        }

        if (scarePoint < 100)
        {
            //Nathan.transform.Find("Firefly").gameObject.SetActive(false);
            currentCond = ghostCond.inHuman;
            if (!worldLighting.activeSelf)
            {
                scarePoint += 0.05f;
            }
            if (musicPlaying)
            {
                scarePoint += 0.05f;
            }
        }

        if (scarePoint > 0)
        {
            scarePoint = scarePoint -= 0.01f;
        }

        UIManager.instance.UpdateScarePoints((int)scarePoint);
    }
Esempio n. 2
0
    private void Awake()
    {
        player = new Controller();

        //Assign light variables to proper objects in scene
        lightSwitch    = GameObject.FindGameObjectWithTag("Lights");
        worldLighting  = GameObject.FindGameObjectWithTag("EnvironmentLights");
        backUpLighting = GameObject.FindGameObjectWithTag("BackUpLights");
        lightScript    = lightSwitch.GetComponent <LightScript>();
        //lightCooldown = 10f;
        lightEnable = true;

        //Assign gramophone variables to proper objects in scene
        gramophone  = GameObject.FindGameObjectWithTag("Gramophone");
        worldMusic  = GameObject.FindGameObjectWithTag("WorldMusic");
        musicScript = gramophone.GetComponent <GramophoneScript>();
        //musicCooldown = 10f;
        musicEnable = true;

        //Assign painting variables to proper objects in scene
        painting    = GameObject.FindGameObjectWithTag("Painting");
        paintScript = painting.GetComponent <PaintingScript>();
        //paintCooldown = 15f;
        paintEnable = true;

        prop       = GameObject.FindGameObjectWithTag("Prop");
        propScript = prop.GetComponent <PropScript>();

        //Assign player numbers and colors
        playernum = numplayers;
        numplayers++;

        //Add by Guanchen Liu
        //Assign nathan
        Nathan      = GameObject.Find("Nathan");
        humanScript = Nathan.GetComponent <HumanBehavior>();
        currentItem = selectedItem.None;
        currentCond = ghostCond.None;
        mainCamera  = GameObject.Find("MainCamera");
        sc          = mainCamera.GetComponent <CameraControl>();
        UI          = UIManager.instance.gameObject;
        var UICoolDown = UI.transform.Find("CoolDown").gameObject;

        // lightImage = UICoolDown.transform.GetChild(0).GetComponent<Image>();
        // musicImage = UICoolDown.transform.GetChild(1).GetComponent<Image>();
        // paintImage = UICoolDown.transform.GetChild(2).GetComponent<Image>();


        player.Gameplay.Grabbing.canceled += context => ReleaseObject();

        if (playernum == 0)
        {
            GameObject temp = GameObject.Find("Ghost_1");
            transform.position = temp.transform.position;
            Destroy(temp);
            mesh.material   = color1;
            gameObject.name = "Ghost_1";
        }
        if (playernum == 1)
        {
            GameObject temp = GameObject.Find("Ghost_2");
            transform.position = temp.transform.position;
            Destroy(temp);
            mesh.material   = color2;
            gameObject.name = "Ghost_2";
            backUpLighting.gameObject.SetActive(false);
            var UIScript = UI.GetComponent <UIManager>();
            Time.timeScale = 1.0f;
            UIScript.playStartImage();
        }

        var allGhost = GameObject.FindGameObjectsWithTag("Ghost");

        choreManger = GameObject.Find("ChoreManger").GetComponent <ChoreManger>();
    }