//Code for the dollar item //Gamecontroller Script else if (this.item[this.itemSelected] == 12) // Dollar Code { Ray ray3 = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit raycastHit3; if (Physics.Raycast(ray3, out raycastHit3)) { if (raycastHit3.collider.name == "BSODAMachine" & Vector3.Distance(this.playerTransform.position, raycastHit3.transform.position) <= 10f) //If the dollar is inserted in the bsoda machine { this.ResetItem(); //Remove the dollar from that slot this.item[0] = 4; //Put a bsoda in item slot 1 this.item[1] = 4; //Put a bsoda in item slot 2 this.item[2] = 4; //Put a bsoda in item slot 3 this.item[3] = 4; //Put a bsoda in item slot 4 this.itemSlot[0].texture = this.itemTextures[4]; //Put the bsoda texture in slot 1 this.itemSlot[1].texture = this.itemTextures[4]; //Put the bsoda texture in slot 2 this.itemSlot[2].texture = this.itemTextures[4]; //Put the bsoda texture in slot 3 this.itemSlot[3].texture = this.itemTextures[4]; //Put the bsoda texture in slot 4 this.UpdateItemName(); //Update the item names for the slots } //Basically, if you put a dollar in the bsoda machine, it gives you 4 bsodas in your first 4 slots else if (raycastHit3.collider.name == "DollarMachine" & Vector3.Distance(this.playerTransform.position, raycastHit3.transform.position) <= 10f) //If the dollar is inserted in the dollar machine { this.ResetItem(); //Remove the dollar from that slot this.item[0] = 5; //Put a quarter in item slot 1 this.item[1] = 5; //Put a quarter in item slot 2 this.item[2] = 5; //Put a quarter in item slot 3 this.item[3] = 5; //Put a quarter in item slot 4 this.itemSlot[0].texture = this.itemTextures[5]; //Put the quarter texture in slot 1 this.itemSlot[1].texture = this.itemTextures[5]; //Put the quarter texture in slot 2 this.itemSlot[2].texture = this.itemTextures[5]; //Put the quarter texture in slot 3 this.itemSlot[3].texture = this.itemTextures[5]; //Put the quarter texture in slot 4 this.UpdateItemName(); //Update the item names for the slots } //Basically, if you put a dollar in the dollar machine, it gives you 4 quarters in your first 4 slots } } //Pickup Script else if (raycastHit.transform.name == "Pickup_Dollar" & Vector3.Distance(this.player.position, base.transform.position) < 10f) { raycastHit.transform.gameObject.SetActive(false); this.gc.CollectItem(12); } //Random item machine code (in the item selected = 5 (quarter) script in gamecontroller) else if (raycastHit3.collider.name == "RandomMachine" & Vector3.Distance(this.playerTransform.position, raycastHit3.transform.position) <= 10f) { int num3 = Mathf.RoundToInt(UnityEngine.Random.Range(1, 10)); this.ResetItem(); //Remove the item this.CollectItem(num3); //Give a random item }