#I have objects that are entering
1 messages · Page 1 of 1 (latest)
ok
there is an enum of machines the object can enter and a list for some reason I dont know the purpose of
@forest dragon can an object enter more than one machine?
uh oh, he's been . . . taken . . .
@forest dragon What is going on?
it's been almost 10 minutes, and Discord says you're Away
At least link the code before going afk
again
public class Enterable : MonoBehaviour
{
public List<Places> AllowedPlaces = new();
}
Places is an enum that contains some places
It is in a seperate Places.cs file
Now attach the Enterable component
To your object which needs to enter something
Then select the places u want.it to be able to enter in the inspector
Now create another script that is attached to a gameobject with a trigger collider
And in its ontriggerenter function
I have barely any code
here is my list of machines
Check if the entered object has the enterable component
If it does, check its list to see if it contains
here is my list of enterables in each gameobject
here is what I have on the transform
The place that corresponds to that gameobject.
link full scripts - https://gdl.space
the full scripts are unrelated, I only care about the bool enterPermit
Good bye.
yep Im reading it and trying to understand it
huh?
Are you though
i'd use an enum with the Flags attribute so you can select all the places an object can enter. when an object attempts to enter a machine, just check if the value of the object's enum variable is contained in the value of the machine's enum variable . . .
wtf Im sorry Im genuinely trying to understand I just dont get the grammar
this is erroneous on my screen
enum Machines
{
heater, grabber, extruder, cutter, press
}
public List<Machines> machines = new();```
how is that even remotely the same
machines are all the places, you want me to predefine all the places before hand no?
enum Machines
{
Heater, Grabber, Extruder, Cutter, Press
}
Put that in its own fole
File
Machines.cs
Put this in Enterable.cs
and add it to a gameobject
then select the allowed Machines in the inspector
now
.
okay, let's try this. make a separate/new script file and create (or copy) your MachineType enum into it. the filename should be the same as the enum . . .
the same exact way all of your filenames match the class name of your other scripts . . .
?
@rose scaffold ok did that, sorry was walking my dog on the mountain
add the [Flags] attribute to the top of the enum. this allows you to select multiple types at once for each object . . .
then create a variable with the enum type on the object — your MachineValues class — and the machine (they can enter) . . .