❔ (Due in about two days) Fish Project for C# Unity
Hiya! I'm new to C# and im currently in university for Game Development in two days I have this project due, and I have a hard time remembering plus the stress of other classes.
it is a game where you catch fish and have a choice to sell or send it to a tank but if you send it to the tank and its bigger than all the other fish it eats them. we have requirements as you can see below.
i have to use 3 scripts: Game Manager, Fish controller(create the fish with random type(string), length(float and value(integer) then spawns the object to Game Manager which then depending on the choice sends it to tank script or deletes it and adds the value Integer. some of the script is being a pain lol.
8 Replies
some of the script is being a pain$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
i do want to ask why you have for loops that will only run once
you mean this ? for (int i = 0; i < 1; i++)
{
fishType.Add(Instantiate(fishPrefab, new Vector3(i * 0, 0, 0),Quaternion.identity));
if (fishType[i].GetComponent<FishController>() != null)
{
FishController fishController = fishType[i].GetComponent<FishController>();
print($" You Caught A {FishController.thisType}! The fish is {FishController.thisLength} Long and has a Value of {FishController.thisValue}. What will you do with it");
}
}
i realised it was useless and i changed it to grab the created one from the FishController script, now im having trouble sending the created Object to the FishTank script
So can you explain the problem fully?
As I am super new, it may be hard for me but I will try my best, I have been able to make a "fish" with three variables(type = string, length = float, value = int), however I have no idea how to send that "fish" to another script(FishTank) to be stored I also need to make it so that if the fish stored in the tanks (float) is higher than the other float variables of fish stored they get "eaten". I can do the unity stuff like TMP buttons and possibly figure out displaying text, it's just sending it to the other script and selling fish that I'm struggling with. I can post my updated scrip again. Hopefully I explained it better, I apologise.
any pointers or pointing out clear errors would be great, I'm having a lot of trouble with this class XD If it could be explained like I'm stupid that would be great lol
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.