コード例 #1
0
ファイル: Chests.cs プロジェクト: Necrosspk/GravWar_Game
 // Use this for initialization
 void Start()
 {
     GGUUII = (OnGUIs)(FindObjectOfType (typeof(OnGUIs)));
     int rand = Random.Range (1, 20);
     if (rand > 9)
         Destroy (this.gameObject);
     script = character.GetComponent<characterControllerScript> ();
     int randPrice = Random.Range (1, 4);
     switch (randPrice) {
     case 1:
     {
             price = 50;
             rare = 1;
             break;
     }
     case 2:
     {
             price = 100;
             rare = 2;
             break;
     }
     case 3:
     {
             price = 200;
             rare = 3;
             break;
     }
     }
     item = Random.Range (0, 11);
     //item = Random.Range (1, 5) * rare + Random.Range(0,3); // RARE - 1 (common) №1-10, RARE - 2 (rare) №11-20, RARE - 3 (unusial) № 21-30
     if (item > 10)
         item = 10;
     if (item == 0)
         item = 3;
 }
コード例 #2
0
ファイル: Chests.cs プロジェクト: Necrosspk/GravWar_Game
    // Use this for initialization
    void Start()
    {
        GGUUII = (OnGUIs)(FindObjectOfType(typeof(OnGUIs)));
        int rand = Random.Range(1, 20);

        if (rand > 9)
        {
            Destroy(this.gameObject);
        }
        script = character.GetComponent <characterControllerScript> ();
        int randPrice = Random.Range(1, 4);

        switch (randPrice)
        {
        case 1:
        {
            price = 50;
            rare  = 1;
            break;
        }

        case 2:
        {
            price = 100;
            rare  = 2;
            break;
        }

        case 3:
        {
            price = 200;
            rare  = 3;
            break;
        }
        }
        item = Random.Range(0, 11);
        //item = Random.Range (1, 5) * rare + Random.Range(0,3); // RARE - 1 (common) №1-10, RARE - 2 (rare) №11-20, RARE - 3 (unusial) № 21-30
        if (item > 10)
        {
            item = 10;
        }
        if (item == 0)
        {
            item = 3;
        }
    }