using System.Collections; using System.Collections.Generic; using UnityEngine; public class Choicepr : MonoBehaviour { static string[] Products = { "apple", "sword", "bow", "arrow", "dog" }; //zamist tego wpisać zmienną w której będą rzeczy które są w sklepie List FinalProducts = new List(); //lista w której zamisano to co klięt kupi List IndexProducts = new List(); int Index; void Start() { for(int i = 0; i < Products.Length; i++) { IndexProducts.Add(i); } int AmountProducts = Random.Range(1, Products.Length + 1); for (int i = 0; i < AmountProducts; i++) { Index = Random.Range(0, IndexProducts.Count); FinalProducts.Add(Products[IndexProducts[Index]]); IndexProducts.RemoveAt(Index); } /* dla testu for (int i = 0; i < FinalProducts.Count; i++) { Debug.Log("Product " + i + ": " + FinalProducts[i]); } */ } }