m!ke
m!ke
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
Alright, do that then. By saving the string parameter as a variable, you are basically making a copy of it.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
But it doesn’t really matter in this game. You can make multiple constructors if you need to.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
If you want the variable to sync with the game1 class hold game1 as a variable and access the gameState property whenever you need it.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
For passing down it the game state it would be something like:
public class screenManager
{
private string _gameState;
public screenManager(string gameState)
{
_gameState = gameState;
}
}
public class screenManager
{
private string _gameState;
public screenManager(string gameState)
{
_gameState = gameState;
}
}
Though with this method, the gameState parameter would not change if it changes in the main object.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
Add a constructor to screen manager with a parameter of type Game1. I believe that code would result in continuous instantiation.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
No no, it’s fine
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
I may have missunderstood OP’s question. 😅
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
The morally correct way would to pass the variable as a parameter in the constructor.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
Just files that you store class data in. An example would be to use a JSON file to store the details about the buttons.
194 replies
CC#
Created by unluqy on 9/30/2024 in #help
OOP guidance (for myself)
So let me get this straight, you have a home screen with multiple buttons, and each button holds an action that changes the screen? As for the second part of having different values, while you could hard code them into the constructor, you may want to hold them in data files that you can parse.
194 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
No worries. Glad I could help. :)
34 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
Well, you gotta complete the pseudo code
34 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
Also, access modifiers cannot be used within methods. Simply do: int myInt = 0;
34 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
Ah okay. Then you’re good
34 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
Did you name a class “Object”?
34 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
I assume “object” in your example code is a placeholder name. You should make it an actual rectangle class/struct, though I assume that is what you mean’t
34 replies
CC#
Created by HouseAdmin on 8/1/2024 in #help
syntax for c# to do this math.
Comments use // in c# (though /**/ for multilines). Give a and b type declarations. Make the method return type a bool, as it uses logic operator. The logic operator for and is &&.
34 replies
CC#
Created by Zelf on 7/31/2024 in #help
Unity aim down sights
You’re welcome. :)
6 replies
CC#
Created by Zelf on 7/31/2024 in #help
Unity aim down sights
Scriptable objects for the positions of optics
6 replies
CC#
Created by Zelf on 7/31/2024 in #help
Unity aim down sights
I would recommend just using camera stacking. Just overlay the gun and the sight on top of the current camera an it will lead to the same effect. Otherwise you can just use some cheap vector math.
6 replies