Content with Hours (Examples included):
Redid slot machine logic
I went and redid the slot machine logic so that it would be easier for anyone to add games to the slot machine. This included instantiating elements from prefabs instead of putting them in locally. ALso Each slot gets randomized.
void Start ()
{
AS = GetComponent<AudioSource>();
GameObject[][] TempArray = new GameObject[maxSlot][];
TempArray[0] = Slot1Elements;
TempArray[1] = Slot2Elements;
TempArray[2] = Slot3Elements;
TempArray[3] = Slot4Elements;
TempArray[4] = SlotBossElements;
//Instatniate All of the Icons and put them in the master array
MasterArray = new GameObject[maxSlot][];
for (int i = 0; i < maxSlot; i++)
{
int vert = 0;
GameObject[] slotArray = new GameObject[TempArray[i].Length];
for (int j = 0; j < TempArray[i].Length; j++)
{
GameObject icon = GameObject.Instantiate(TempArray[i][j], offsidesPosition.transform.position,TempArray[i][j].transform.localRotation) as GameObject;
icon.transform.localScale = transform.localScale;
slotArray[j] = icon;
if (vert >= maxSlot)
{
icon.transform.position = new Vector3(horizontalElements[i].transform.position.x,
verticalElements[0].transform.position.y,
verticalElements[0].transform.position.z);
}
else
{
icon.transform.position = new Vector3(horizontalElements[i].transform.position.x,
verticalElements[vert].transform.position.y,
verticalElements[vert].transform.position.z);
}
vert += 1;
}
slotArray = RandomizeArray(slotArray);
MasterArray[i] = slotArray;
}
}
static GameObject[] RandomizeArray(GameObject[] arr)
{
for (int i = arr.Length - 1; i > 0; i--)
{
int r = Random.Range(0, i);
GameObject tmp = arr[i];
arr[i] = arr[r];
arr[r] = tmp;
}
return arr;
}
(3 hrs)
I added the slot machine to the transitions so that after 5 games the next set of games could be loaded and played. This took a ton of retooling of the current framework. I had to rip the guts out of the code to do this, but it was old code anyway so I don't feel so bad about it.
(3 hrs)
Content Positive
Got a lot of work done.
Content Negative
Had car trouble and did not compete one of my tasks.
Total Hours for the week: 6 hrs
No comments:
Post a Comment