Exemplo n.º 1
0
 private void LoadCardInfo(int i)
 {
     if (layers[i] != null)       // just to be safe
     {
         notRevealedCard.SetActive(false);
         LayerProperty current = layers[i];
         //LayerType currentType = current.type;
         String layerName = current.GetPrintName();
         if (isNone[i])
         {
             // swap to other card
             notRevealedCard.SetActive(true);
             String printName = "Not Revealed";
             rock.sprite = GetSpriteByName(printName);
             number.text = (i + 1).ToString();
         }
         else
         {
             name.text         = current.GetPrintName();
             permeability.text = current.GetPorosity().ToString() + " %";
             density.text      = current.GetDensity().ToString() + " kg/m^3";
             probability.text  = String.Format("{0:F0}", current.GetPossibility()) + " %";        // format to chop off extra decimals
             number.text       = (i + 1).ToString();
             rock.sprite       = GetSpriteByName(current.GetPrintName());
         }
     }
 }
Exemplo n.º 2
0
    public bool Popups(LayerProperty layerProperty)
    {
        // get layer info
        layer        = layerProperty;
        type         = layer.type;
        name         = layer.gameObject.name;
        shape        = DataManager.instance.GetLayerShape(name);
        shelfupdated = false;        //to check if the shelf is updated.
        // check if layer is revealed
        isRevealed = checkRevealed(name);

        if (isRevealed)
        {
            // current layer
            Invoke("Wait", 4);
            rockCount++;
            return(true);
        }

        else
        {
            Debug.Log("print name is");
            Debug.Log(layer.GetPrintName());
            Invoke("WaitNotRevealed", 4);
            rockCount++;
            return(false);
        }
    }
Exemplo n.º 3
0
    private void UpdateShelf(GameObject clone, bool revealed)
    {
        ShelfNew shelf;

        shelf = GameObject.Find("ShelfNew").GetComponent <ShelfNew>();
        string layerName = "blank";

        if (revealed)
        {
            layerName = layer.GetPrintName();
        }
        else
        {
            layerName = "Not Revealed";
        }
        shelf.AddJar(layerName);
        SoundFXCtrl.instance.PlaySound(8, 1);
    }
Exemplo n.º 4
0
    // Use this for initialization
    public void InitJars()
    {
        samples = DataManager.instance.GetCollectedSamples();
        size    = samples.Length;
        Debug.Log("size");
        Debug.Log(size);
        if (size > 0)
        {
            GameObject emptyCard = GameObject.Find("Empty Info");
            emptyCard.SetActive(false);             // cannot find inactive game objects - must handle here.
            notRevealedCard = GameObject.Find("Not Revealed Info");
            notRevealedCard.SetActive(false);
            //jars = gameObject.GetComponentsInChildren<Image>();
            for (int i = 0; i < size; i++)
            {
                // get layers
                string layerName = ((CoreSample)samples[i]).layername;
                string printName = "";
                if (layerName == "None")
                {
                    printName = "Not Revealed";
                    isNone[i] = true;
                }
                else
                {
                    orgLayer  = GameObject.Find(layerName);
                    layer     = orgLayer.GetComponent <LayerProperty> ();
                    type      = layer.type;
                    printName = layer.GetPrintName();
                    isNone[i] = false;
                }
                layers[i] = layer;

                // add correct number of jars to list and enable them
                GameObject thisJar      = GameObject.Find("Jar" + (i + 1).ToString());
                Image      thisJarImage = thisJar.GetComponent <Image>();
                thisJarImage.enabled = true;
                jars[i] = thisJarImage;

                // add correct number of rocks to list, enable them, and set to right texture
                GameObject thisRock      = GameObject.Find("Rock" + (i + 1).ToString());
                Image      thisRockImage = thisRock.GetComponent <Image>();
                thisRockImage.sprite  = GetSpriteByName(printName);
                thisRockImage.enabled = true;
                smallRocks[i]         = thisRockImage;

                // add correct text to list, enable them, set to right name
                GameObject thisText     = GameObject.Find("Text" + (i + 1).ToString());
                Text       thisTextText = thisText.GetComponent <Text>();
                thisTextText.text    = printName;
                thisTextText.enabled = true;
                labels[i]            = thisTextText;

                // old stuff
                //Color color = DataManager.instance.GetColorOfLayerName (layerName);
                //jars[i+1].enabled = true; // jars has shelf first so index is 1 up
                //jars[i+1].color = color; // might be able to just do this using layer properties. check later.

                //colors[i] = color;
            }
            //jars[index+1].enabled=false; // jars[0] is the shelf
            jars[0].sprite        = missingJar;
            smallRocks[0].enabled = false;
            //rock.color = jars[index+1].color; // make rock correct color
            LoadCardInfo(0);
        }

        else
        {
            rock.enabled = false;             // no rock if no samples
            GameObject regCard = GameObject.Find("Info");
            regCard.SetActive(false);
        }
    }