コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        // get the script from the clock
        clock_script = clock.GetComponent <Game_Time>();

        // find the angle of the Earth in degrees from the current hour and minutes
        theta = -15 * (clock_script.hours + clock_script.minutes / 60);

        // apply the rotation to the Earth
        earth.transform.rotation = Quaternion.Euler(0, theta, 0);
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        clock_script = clock.GetComponent <Game_Time>();
        day          = clock_script.days;

        if (day < 3)
        {
            days_from_perihelion = day + 365;
            if (clock_script.year % 4 == 0)
            {
                days_from_perihelion++;
            }
        }
        else
        {
            days_from_perihelion = day;
        }
    }
コード例 #3
0
        public Game_Timer()
        {
            _thread = new Thread(() =>
            {
                while (true)
                {
                    //try
                    //{
                    Game_Time.AddTime(60);

                    if (_reductionParameters >= 3)
                    {
                        int maxNeeds = _need + GameCharacter.NeedsStudy + GameCharacter.NeedsWork;

                        int randomFood   = random.Next(1, maxNeeds);
                        int randomMood   = random.Next(1, maxNeeds);
                        int randomHealth = random.Next(1, maxNeeds);

                        GameCharacter.ReducingNeeds(randomFood, randomMood, randomHealth);

                        _reductionParameters = 0;
                    }

                    Decrease_Intelligence();
                    Decrease_Charm();
                    Decrease_PhysicalDevelopment();
                    //}
                    //catch (Exception error)
                    //{
                    //    MessageBox.Show(error.Message);
                    //}

                    _reductionParameters += 1;

                    TimePassedGameSecond += 1;

                    Thread.Sleep(_timerSleep);
                }
            });
            _thread.IsBackground = true;
            _thread.Start();
        }
コード例 #4
0
ファイル: ThePresident.cs プロジェクト: Sergeygaan/MyProject
 private void button2_Click(object sender, EventArgs e)
 {
     Game_Time.AddTime(2100);
 }