コード例 #1
0
    //public CompAnim _compAnim;
    // Use this for initialization
    void Start()
    {
        podlozka = GameObject.FindWithTag("podlozka");
        podlozka.SetActive(true);
        textPodlozka = GameObject.FindWithTag("textPodlozka");
        textPodlozka.SetActive(true);
        Text _textPodlozka = textPodlozka.GetComponent <Text>();

        _textPodlozka.text = "Hello";
        almaz    = GameObject.Find("almazik_0");
        compAnim = GameObject.Find("compAnim").GetComponent <CompAnim>();
        pole     = GameObject.FindWithTag("Pole");
        if (NumbersThis == null)
        {
            cellNumber  = Random.Range(0, 11);
            NumbersThis = (GameObject)Instantiate(Numbers, new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
            SpriteRenderer chouseSprite = NumbersThis.AddComponent <SpriteRenderer>();
            chouseSprite.sprite           = numbers[cellNumber];
            numberPosition                = NumbersThis.gameObject.transform.position.y;
            chouseSprite.sortingLayerName = "cell";
            chouseSprite.sortingOrder     = 3;
        }

        //ColorThis = (GameObject)Instantiate(Numbers, new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
        SpriteRenderer chouseColor = gameObject.GetComponent <SpriteRenderer>();

        if (!isColor)
        {
            color = Random.Range(0, 2);
            chouseColor.sprite           = colors[color];
            chouseColor.sortingLayerName = "cell";
            chouseColor.sortingOrder     = 1;
        }
    }
コード例 #2
0
 //public CompAnim _compAnim;
 // Use this for initialization
 void Start()
 {
     podlozka = GameObject.FindWithTag("podlozka");
     podlozka.SetActive(true);        
     textPodlozka = GameObject.FindWithTag("textPodlozka");
     textPodlozka.SetActive(true);
     Text _textPodlozka = textPodlozka.GetComponent<Text>();
     _textPodlozka.text = "Hello";
     almaz = GameObject.Find("almazik_0");
     compAnim = GameObject.Find("compAnim").GetComponent<CompAnim>();
     pole = GameObject.FindWithTag("Pole");
     if (NumbersThis == null)
     {
         cellNumber = Random.Range(0, 11);
         NumbersThis = (GameObject)Instantiate(Numbers, new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
         SpriteRenderer chouseSprite = NumbersThis.AddComponent<SpriteRenderer>();
         chouseSprite.sprite = numbers[cellNumber];
         numberPosition = NumbersThis.gameObject.transform.position.y;
         chouseSprite.sortingLayerName = "cell";
         chouseSprite.sortingOrder = 3;
     }
     
     //ColorThis = (GameObject)Instantiate(Numbers, new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
     SpriteRenderer chouseColor = gameObject.GetComponent<SpriteRenderer>();
     if (!isColor)
     {
         color = Random.Range(0, 2);
         chouseColor.sprite = colors[color];
         chouseColor.sortingLayerName = "cell";
         chouseColor.sortingOrder = 1;
     }
     
 }