Ejemplo n.º 1
0
    void Update()
    {
        if (go)
        {
            if (pg.time < 1f)
            {
                pg.time += Time.deltaTime * growthSpeed;

                if (updateRate * Time.deltaTime + lastUpdate <= Time.time)
                {
                    if (hasMoss)
                    {
                        moss.time = pg.time;
                        moss.UpdateMoss();
                    }

                    //GameManager.SavePlantTime (pg.indexInGameData, pg.time);

                    pg.UpdatePlant();
                    lastUpdate = Time.time;
                }
            }
            else
            {
                pg.time = 1f;
                go      = false;
            }
        }
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        Moss myObject = (Moss)target;

        EditorGUI.BeginChangeCheck();
        DrawDefaultInspector();
        if (EditorGUI.EndChangeCheck())
        {
            myObject.UpdateMoss();
        }
    }
Ejemplo n.º 3
0
    public void Lauch()
    {
        go = true;
        //canGrow = true;
        pg = GetComponent <Plant> ();

        pg.InitializePlant();

        growthSpeed = 1f / pg.maxDuration;
        lastUpdate  = Time.time;

        if (hasMoss)
        {
            moss = (Moss)Instantiate(GameManager.gm.pm.mossPrefab, transform);
            moss.transform.localPosition = Vector3.zero;
            moss.finalRadius             = mossRadius;

            moss.time = pg.time;
            moss.UpdateMoss();
        }
    }