Inheritance: MonoBehaviour
 // Update is called once per frame
 void Update()
 {
     if (DayNightController.getDayNightController().isTimeToCloseBuidings() && !shopsClosed)
     {
         foreach (Transform child in buildings)
         {
             BoxCollider bc = child.GetComponent <BoxCollider>();
             if (bc)
             {
                 bc.enabled = false;
             }
         }
         shopsClosed = true;
     }
     else if (DayNightController.isDaytime() && shopsClosed)
     {
         foreach (Transform child in buildings)
         {
             BoxCollider bc = child.GetComponent <BoxCollider>();
             if (bc)
             {
                 bc.enabled = true;
             }
         }
         shopsClosed = false;
     }
 }
    // Use this for initialization
    void Start()
    {
        if (PlayerPrefs.HasKey("deathCount"))
        {
            storedDeathCount = PlayerPrefs.GetInt("deathCount");
        }

        platformStartPoint   = platformGenerator.position;
        playerStartPoint     = thePlayer.transform.position;
        backgroundStartPoint = theBackgroundGenerator.transform.position;

        theDayNightController           = FindObjectOfType <DayNightController> ();
        theAdManager                    = FindObjectOfType <AdManager> ();
        theParallaxController           = FindObjectOfType <Parallax> ();
        theScoreManager                 = FindObjectOfType <ScoreManager> ();
        thePowerupController            = FindObjectOfType <PowerupManager> ();
        firstMovingBackgroundStartPoint = theParallaxController.backgrounds[0].transform.localPosition;

        if (!PlayerPrefs.HasKey("InstructionShown"))
        {
            theGameInstructionsScreen.SetActive(true);
            PlayerPrefs.SetString("InstructionShown", "true");
            Time.timeScale = 0f;
        }
    }
    public PlayerData(Player player, Camera camera, StatManager statManager, DayNightController dayNightController)
    {
        stats    = new float[6];
        stats[0] = statManager.GetPhys();
        stats[1] = statManager.GetMent();
        stats[2] = statManager.GetNutri();
        stats[3] = statManager.GetHygiene();
        stats[4] = statManager.GetEnergy();
        stats[5] = statManager.GetAbility();

        position    = new float[3];
        position[0] = player.transform.position.x;
        position[1] = player.transform.position.y;
        position[2] = player.transform.position.z;

        Vector3 cameraOriginalPosition = CameraFollowPlayer.originalPosition;

        cameraPosition    = new float[3];
        cameraPosition[0] = cameraOriginalPosition.x;
        cameraPosition[1] = cameraOriginalPosition.y;
        cameraPosition[2] = cameraOriginalPosition.z;

        time = dayNightController.getCurrentTimeOfDay();
        day  = dayNightController.getNumDays();

        gameOver = dayNightController.isOver();
    }
    // Start is called before the first frame update
    void Start()
    {
        gameManager = GameObject.Find("GameManager");
        if (gameManager != null)
        {
            isReady            = true;
            dayNightController = gameManager.GetComponent <DayNightController>();

            if (dayNightController == null)
            {
                dayButton.SetActive(false);
                nightButton.SetActive(false);
                engineButton.SetActive(false);
                musicButton.SetActive(false);
            }
            else
            {
                if (dayNightController.changeEnabled)
                {
                    dayButton.SetActive(true);
                    nightButton.SetActive(true);
                    engineButton.SetActive(true);
                    musicButton.SetActive(true);
                }
                else
                {
                    dayButton.SetActive(false);
                    nightButton.SetActive(false);
                    engineButton.SetActive(false);
                    musicButton.SetActive(false);
                }
            }
        }
    }
Example #5
0
    void Awake()
    {
        instance = GameObject.Find("SfxManager");
        if (instance != null && instance != gameObject)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        SceneManager.sceneLoaded += (scene, mode) =>
        {
            dnc = FindObjectOfType <DayNightController>();
        };

        globalSounds    = sounds;
        globalSfxPlayer = sfxPlayer;

        AudioSource[] sources = instance.GetComponents <AudioSource>();
        day   = sources[1];
        night = sources[2];

        day.Play();
        night.Play();
        sources[0].Play();
    }
Example #6
0
    public void handlePlayerSleep()
    {
        taskManager.checkTasks();

        DayNightController.freezeTime();

        recapManager.setInitialConfiguartion();

        recapPlane.gameObject.SetActive(true);
        minimapPanel.gameObject.SetActive(false);
        recapManager.startTyping();

        miiSoundSource.Play();

        playerInControl = false;

        showMouse();

        foreach (Transform child in bed.transform)
        {
            if (child.name.Equals("NextToBed"))
            {
                transform.position = child.position;
            }
        }
    }
Example #7
0
 void Start()
 {
     dnController = FindObjectOfType <DayNightController>();
     lamp         = GetComponentInChildren <Light>();
     turnOn       = turnOnTime / 24;
     turnOff      = turnOffTime / 24;
 }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        float dayRatio = DayNightController.getDayRatio();

        if (DayNightController.isDay())
        {
            if (dayRatio < MID_DAY_BEGIN)
            {
                float ratio = MathHelper.Map(dayRatio, 0, MID_DAY_BEGIN, 0, 1);
                gameObject.transform.position = Vector3.Lerp(beginPosition.transform.position, firstWindowMark.transform.position, ratio);
            }
            else if (dayRatio > MID_DAY_BEGIN && dayRatio < MID_DAY_END)
            {
                float ratio = MathHelper.Map(dayRatio, MID_DAY_BEGIN, MID_DAY_END, 0, 1);
                gameObject.transform.position = Vector3.Lerp(firstWindowMark.transform.position, secondWindowMark.transform.position, ratio);
            }
            else
            {
                float ratio = MathHelper.Map(dayRatio, MID_DAY_END, 1, 0, 1);
                gameObject.transform.position = Vector3.Lerp(secondWindowMark.transform.position, endPosition.transform.position, ratio);
            }
        }
        else
        {
            gameObject.transform.position = Vector3.Lerp(endPosition.transform.position, beginPosition.transform.position, dayRatio);
        }
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #10
0
    void Start()
    {
        GameObject temp = GameObject.Find("DayNightController");
        if (dayNight != null)
            dayNight = temp.GetComponent<DayNightController>();

        worldLight = GetComponent<Light>();
    }
Example #11
0
    void Start()
    {
        ps = GameObject.Find("Player").GetComponent <PlayerStatus>();

        if (GameObject.Find("DayNightCycle") != null)
        {
            dn = GameObject.Find("DayNightCycle").GetComponent <DayNightController>();
        }
    }
Example #12
0
 private void OnEnable()
 {
     pv                 = GetComponent <PhotonView>();
     animator           = GetComponent <Animator>();
     gameManager        = FindObjectOfType <GameManager>();
     dayNightController = gameManager.GetComponent <DayNightController>();
     noteRotate         = GameObject.FindGameObjectWithTag("CAM").GetComponentInChildren <NoteRotate>();
     voteRotate         = GameObject.FindGameObjectWithTag("CAM").GetComponentInChildren <VoteRotate>();
     shooted            = false;
 }
Example #13
0
 public void endRecap()
 {
     StatsManager.resetRecap();
     recap.resetActions();
     recap.resetCurrentText();
     recapPlane.gameObject.SetActive(false);
     recap.endTyping();
     recap.resetSkip();
     DayNightController.getDayNightController().startNewDay();
 }
Example #14
0
    public void ClientReady()
    {
        Debug.Log("Client Ready");
        DNC = GameObject.FindWithTag("Volume").GetComponent <DayNightController>();
        DNC.Init();

        /*
         * foreach (GameServer.Spawnable G in GameServer.GS.Spawnables)
         * {
         *  RegisterNewObject(G.Prefab);
         * }*/
    }
Example #15
0
 void Update()
 {
     if (DayNightController.isDaytime() && isNight)
     {
         playDaytimeSounds();
         isNight = false;
     }
     else if (DayNightController.isNighttime() && !isNight)
     {
         playNighttimeSounds();
         isNight = true;
     }
 }
Example #16
0
 void Awake()
 {
     dayNightController = this;
     timeMultiplier     = 1f;
     numDays            = 1;
     currentTimeOfDay   = startOfDaytime;
     GameWon            = false;
     if (LevelLoader.LoadingSavedFile)
     {
         LoadTime();
     }
     dayText.text = "Day: " + numDays;
 }
Example #17
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else
        {
            DestroyImmediate(this);
        }

        _dayNightController = GetComponent <DayNightController>();
    }
    void Update()
    {
        setShaderAmbientColor();
        setLightAmbientColor();
        int day      = (DayNightController.isDay()) ? 1 : 0;
        int gameOver = (SceneManager.isGameOver()) ? 1 : 0;

        shaderMaterial.SetInt("_Day", day);
        shaderMaterial.SetInt("_GameOver", gameOver);
        shaderMaterial.SetFloat("_DayRatio", DayNightController.getDayRatio());
        //shaderMaterial.SetVector("_InsanityVector", new Vector4(Random.Range(-0.02f, 0.02f), Random.Range(-0.02f, 0.02f), 0,0 ));
        //shaderMaterial.SetVector("_InsanityVector2", new Vector4(Random.Range(-0.01f, 0.01f), Random.Range(-0.01f, 0.01f), 0,0 ));
    }
Example #19
0
    // Use this for initialization
    void Start()
    {
        currentRoom = 0;
        Cursor.visible = false;
        dnControl = this.GetComponent<DayNightController>();

        GameObject[] roomRes = GameObject.FindGameObjectsWithTag("Room");
        rooms = new GameObject[roomRes.Length];

        foreach (GameObject room in roomRes) {
            int roomID = System.Int32.Parse(room.gameObject.name.Replace("Room ", ""));

            rooms[roomID] = room;
            rooms[roomID].GetComponent<Room>().roomID = roomID;
        }
    }
Example #20
0
    // Use this for initialization
    void Start()
    {
        currentRoom    = 0;
        Cursor.visible = false;
        dnControl      = this.GetComponent <DayNightController>();

        GameObject[] roomRes = GameObject.FindGameObjectsWithTag("Room");
        rooms = new GameObject[roomRes.Length];

        foreach (GameObject room in roomRes)
        {
            int roomID = System.Int32.Parse(room.gameObject.name.Replace("Room ", ""));

            rooms[roomID] = room;
            rooms[roomID].GetComponent <Room>().roomID = roomID;
        }
    }
    private void setLightAmbientColor()
    {
        float dayRatio = DayNightController.getDayRatio();
        Color begin;
        Color middle;
        Color end;

        if (DayNightController.isDay())
        {
            begin  = LightDayBeginColor;
            middle = LightDayMiddleColor;
            end    = LightDayEndColor;

            if (dayRatio < 0.5f)
            {
                currentLightColor.r = MathHelper.Map(dayRatio, 0, 0.5f, begin.r, middle.r);
                currentLightColor.g = MathHelper.Map(dayRatio, 0, 0.5f, begin.r, middle.r);
                currentLightColor.b = MathHelper.Map(dayRatio, 0, 0.5f, begin.r, middle.r);
                currentLightColor.a = 1;

                if (dayRatio < 0.3)
                {
                    currentLightColor.r = MathHelper.Map(dayRatio, 0, 0.3f, currentAmbientColor.r, currentLightColor.r);
                    currentLightColor.g = MathHelper.Map(dayRatio, 0, 0.3f, currentAmbientColor.g, currentLightColor.g);
                    currentLightColor.b = MathHelper.Map(dayRatio, 0, 0.3f, currentAmbientColor.b, currentLightColor.b);
                }
            }
            else
            {
                currentLightColor.r = MathHelper.Map(dayRatio, 0.5f, 1, middle.r, end.r);
                currentLightColor.g = MathHelper.Map(dayRatio, 0.5f, 1, middle.g, end.g);
                currentLightColor.b = MathHelper.Map(dayRatio, 0.5f, 1, middle.b, end.b);
                currentLightColor.a = 1;

                if (dayRatio > 0.7)
                {
                    currentLightColor.r = MathHelper.Map(dayRatio, 0.7f, 1.0f, currentLightColor.r, currentAmbientColor.r);
                    currentLightColor.g = MathHelper.Map(dayRatio, 0.7f, 1.0f, currentLightColor.g, currentAmbientColor.g);
                    currentLightColor.b = MathHelper.Map(dayRatio, 0.7f, 1.0f, currentLightColor.b, currentAmbientColor.b);
                }
            }

            shaderMaterial.SetColor("_LightColor", currentLightColor);
        }
    }
Example #22
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (_controller == null)
        {
            _controller = (DayNightController)target;
        }

        var worldTime = serializedObject.FindProperty("LocalTime");

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label(worldTime.FindPropertyRelative("Hours").intValue.ToString(), GUILayout.MaxWidth(20));
        GUILayout.Label(":", GUILayout.MaxWidth(10));
        GUILayout.Label(worldTime.FindPropertyRelative("Minutes").intValue.ToString(), GUILayout.MaxWidth(20));
        EditorGUILayout.EndHorizontal();

        _controller.SecondsInFullDay = EditorGUILayout.IntField("Seconds in full day: ", _controller.SecondsInFullDay);
    }
Example #23
0
    // Update is called once per frame
    void Update()
    {
        if (StatManager.GameOver || DayNightController.GameWon)
        {
            showMouse();
            playerInControl = false;
        }

        if (inEvent)
        {
            speed = 0f;
        }
        else if (isFatigued)
        {
            speed = 4f;
        }
        else
        {
            speed = maxSpeed;
        }

        // Delete when release for beta TODO

/*        if (Input.GetKey(KeyCode.Alpha8))
 *      {
 *          speed = 30f;
 *          print("hello");
 *      }
 *      else
 *      {
 *          speed = 8f;
 *      }*/
        // End of delete


        playerGravity();
        playerControl();

        if (DayNightController.getDayNightController().isSleep() && playerInControl)
        {
            teleportToSleep();
        }
    }
Example #24
0
    private void OnEnable()
    {
        StartCoroutine(Logo());
        PhotonNetwork.isMessageQueueRunning = true;
        pv                 = GetComponent <PhotonView>();
        easyTween          = GetComponent <EasyTween>();
        readyManager       = FindObjectOfType <ReadyManager>();
        dayNightController = GetComponent <DayNightController>();

        localCam    = readyManager.localCam;
        localPlayer = readyManager.localPlayer;
        localPlayer.GetComponent <JobManager>().enabled = true;
        thirdPersonUserControl = readyManager.thirdPersonUserControl;
        freeLookCam            = readyManager.freeLookCam;


        if (PhotonNetwork.player.IsMasterClient)
        {
            SetPlayerJob();
        }
    }
Example #25
0
    public void ServerReady(NetworkConnection conn)//server ready
    {
        Debug.Log("Server Ready");

        /*
         * if(GameServer.GS != null)
         * {
         *  foreach (GameServer.Spawnable G in GameServer.GS.Spawnables)
         *  {
         *      RegisterNewObject(G.Prefab);
         *  }
         * }*/

        DNC = GameObject.FindWithTag("Volume").GetComponent <DayNightController>();
        DNC.Init();

        NC = conn;
        GameObject.FindWithTag("Manager").GetComponent <ItemSpawner>().TurnOn();
        StartCoroutine(NewDay());

        //InvokeRepeating("TickForward", TickRate, TickRate);
    }
Example #26
0
    private NPCActivityFlag ActivityFlag = NPCActivityFlag._NO_FLAG_; //Used for activity based Dia

    private void Awake()
    {
        int total = 0;

        for (int i = 0; i < NPC_Facs_Percentages_input.Count; ++i)
        {
            total += NPC_Facs_Percentages_input[i];
            NPC_Facs_Percentages.Add(total);
        }

        if (NPC_Facs.Count != 0)
        {
            Assert.IsTrue(total == 100);
            Assert.IsTrue(CustomActivities.Count == 0);
        }
        Assert.IsTrue(NPC_Facs.Count == NPC_Facs_Percentages_input.Count);


        HM  = GetComponentInParent <HumanoidMaster>();
        NL  = FindObjectOfType <NPC_Logic>();
        DNC = FindObjectOfType <DayNightController>();
        StartCoroutine(DelayedStart());
    }
    private void setShaderAmbientColor()
    {
        float dayRatio = DayNightController.getDayRatio();
        Color begin;
        Color middle;
        Color end;

        if (DayNightController.isDay())
        {
            begin  = AmbientDayBeginColor;
            middle = AmbientDayMiddleColor;
            end    = AmbientDayEndColor;
        }
        else
        {
            begin  = AmbientNightBeginColor;
            middle = AmbientNightMiddleColor;
            end    = AmbientNightEndColor;
        }

        if (dayRatio < 0.5f)
        {
            currentAmbientColor.r = MathHelper.Map(dayRatio, 0, 0.5f, begin.r, middle.r);
            currentAmbientColor.g = MathHelper.Map(dayRatio, 0, 0.5f, begin.g, middle.g);
            currentAmbientColor.b = MathHelper.Map(dayRatio, 0, 0.5f, begin.b, middle.b);
            currentAmbientColor.a = 1;
        }
        else
        {
            currentAmbientColor.r = MathHelper.Map(dayRatio, 0.5f, 1, middle.r, end.r);
            currentAmbientColor.g = MathHelper.Map(dayRatio, 0.5f, 1, middle.g, end.g);
            currentAmbientColor.b = MathHelper.Map(dayRatio, 0.5f, 1, middle.b, end.b);
            currentAmbientColor.a = 1;
        }
        shaderMaterial.SetColor("_AmbientColor", currentAmbientColor);
    }
Example #28
0
 void Awake()
 {
     if(controller==null)
         controller = GameObject.FindGameObjectWithTag("GameController").GetComponent<DayNightController>();
 }
Example #29
0
 void Awake()
 {
     // Find the DayNightController game object by its name and get the DayNightController script on it.
     controller = this.GetComponent<DayNightController> ();
 }
Example #30
0
 void Start()
 {
     dayNightController = GameManager.GetInstance.GetGameObjectsOfType<DayNightController>()[0];
 }
Example #31
0
 // Use this for initialization
 void Start()
 {
     dncontrol = GetComponent <DayNightController>();
 }
Example #32
0
 protected override void doEvent()
 {
     DayNightController.SkipTime(this);
 }
	void Awake() {
		instance = this;
	}
Example #34
0
 protected override bool hasPrereqs()
 {
     return(DayNightController.CanSkipTime(this.minutesToSkip));
 }
Example #35
0
 void Awake()
 {
     controller = GameObject.Find("DayNightController").GetComponent<DayNightController>();
 }
 void Start()
 {
     Player   = GameObject.FindGameObjectWithTag("Player");
     dayNight = FindObjectOfType <DayNightController>();
 }
Example #37
0
 // Start is called before the first frame update
 void Start()
 {
     dnc = gameObject.GetComponent<DayNightController>();
     
    
 }
Example #38
0
	void Awake() {
		controller = GetComponent<DayNightController>();
	}