https://github.com/rpdevjesco/codewarsthebattleoflists
The code for the video https://www.youtube.com/watch?v=sF0qsYBXeFc&t=5s
https://github.com/rpdevjesco/codewarsthebattleoflists
Last synced: over 1 year ago
JSON representation
The code for the video https://www.youtube.com/watch?v=sF0qsYBXeFc&t=5s
- Host: GitHub
- URL: https://github.com/rpdevjesco/codewarsthebattleoflists
- Owner: RPDevJesco
- License: gpl-3.0
- Created: 2018-01-25T04:37:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-25T10:37:18.000Z (over 8 years ago)
- Last Synced: 2025-04-13T03:18:39.673Z (over 1 year ago)
- Language: C#
- Size: 136 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeWarsTheBattleOfLists
The code for the video https://www.youtube.com/watch?v=sF0qsYBXeFc&t=5s
In order to get this code to work with Unity3D, there is a slight change you need to make for the Lists.
This is how your shuffledResults class should look.
using System.Linq;
public class ShuffledResultClass
{
public List ShuffledResults(List main, List secondary)
{
GameObject[] arr = main.ToArray();
TheShuffleClass.Shuffle(arr);
var converted = arr.Distinct().ToList();
foreach (var item in converted)
secondary.Add(item);
return secondary;
}
}
Then for the class that implements Monobehavior, it should look something like this for the basics...
public class MonoBehaviorScripting : MonoBehaviour
{
public List main;
List secondary;
void Start ()
{
secondary = new List();
ShuffledResultClass shuff = new ShuffledResultClass();
shuff.ShuffledResults(main, secondary);
for (int i = 0; i < secondary.Count; i++)
Instantiate(secondary[i] as GameObject);
}
}