コード例 #1
0
    public void update(PlantManager pm)
    {
        if (!Menu.running)
        {
            return;
        }

        timer += 6 * Time.deltaTime;

        Vector3 newPos = new Vector3(0f, 0f);

        newPos.x = Mathf.Cos((timer * Mathf.PI) / 180f) * 1.5f;
        newPos.y = Mathf.Sin((timer * Mathf.PI) / 180f) * 1.5f;

        transform.position = newPos;
        skyColor(); triggers();

        if (timer > 270)
        {
            timer     = -90f;
            day       = !day;
            dayNum   += 0.5f;
            days.text = "Day: " + dayNum;

            sm.update(dayNum);
            wm.cycle(sm.getSeason());

            if (day)
            {
                bm.newDawn(sm.getSeason(), wm.getWeather(), pm.getPlants());
                saveManager.save();
            }
            else
            {
                bm.newDusk(sm.getSeason(), wm.getWeather(), pm.getPlants());
            }

            beastTrigger = true;
        }

        else if (timer > 90 && beastTrigger)
        {
            beastTrigger = false;
            if (day)
            {
                bm.newDay(sm.getSeason(), wm.getWeather(), pm.getPlants());
            }
            else
            {
                bm.newNight(sm.getSeason(), wm.getWeather(), pm.getPlants());
            }
        }
    }
コード例 #2
0
ファイル: Plant.cs プロジェクト: facybenbook/Master-of-Garden
    public virtual void load(int[] data)
    {
        index = data[10]; order = data[11];

        pm.loadPlant(pm.getPlants()[order].gameObject, pm.getAll()[index], data);
    }