k
k
This commit is contained in:
parent
c853e57f68
commit
6aa72edd9a
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -1,35 +1,35 @@
|
||||
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<string> FinalProducts = new List<string>(); //lista w której zamisano to co klięt kupi
|
||||
List<int> IndexProducts = new List<int>();
|
||||
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]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
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<string> FinalProducts = new List<string>(); //lista w której zamisano to co klięt kupi
|
||||
List<int> IndexProducts = new List<int>();
|
||||
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]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user