public void RemoveSlot() { ArtifactsScript artifact = currentSlot.GetComponent <GarageSlot> ().assignedArtifact; FindObjectOfType <PlayerScript> ().garage.Remove(artifact); artifactWorthText.text = artifact.moneyValue.ToString(); artifactWorthObject.SetActive(true); artifactDisplayObject.SetActive(false); }
private void AuctionManager() { allArtifactsHaveBeenBought = !CheckForAvailableArtifacts(); // If no auctions are currently happening ... if (auctionIsHappening == false) { if (!allArtifactsHaveBeenBought) { // ... get a new artifact currentArtifact = GetNewArtifact(); // Get value of Initial Offer currentOffer = offerManager.GetNewOffer(); initialOffer = currentOffer; // Update the "Current Artifact" sprite, artifactGraphic.sprite = currentArtifact.graphic; // And now the auction is happening. auctionIsHappening = true; } else { Debug.Log("No Artifacts Left!"); gameOver = true; } } // If an auction is already happening then ... else { // ... and the Current Artifact has already been bought ... if (currentArtifact.hasBeenBought) { // ... then end this auction auctionIsHappening = false; } // If the Current Artifact hasn't been bought yet, then wait. } }
private ArtifactsScript GetNewArtifact() { List <ArtifactsScript> availableArtifactsList = new List <ArtifactsScript>(); // Go through all the artifacts for (int i = 0; i < artifacts.Length; i++) { // If the artifact has NOT been bought ... if (!artifacts[i].hasBeenBought) { // ... and the player has money and space for it ... if (player.availableMoney >= artifacts[i].moneyValue) { // Add it to the available list availableArtifactsList.Add(artifacts [i]); } } } ArtifactsScript newArtifact = availableArtifactsList [Random.Range(0, availableArtifactsList.Count)]; return(newArtifact); }