k
This commit is contained in:
meteor 2024-10-21 12:10:41 +02:00
parent c853e57f68
commit 6aa72edd9a
3 changed files with 35 additions and 35 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

View File

@ -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]);
}
*/
}
}