#Alright Just thinking how I will be able

1 messages · Page 1 of 1 (latest)

thick veldt
#

FadeArea is not a Tilemap

#

It might often exist alongside a Tilemap

#

but it is not a Tilemap

#

FadingSprite will look at a list of FadeAreas

uncut bane
#

What will FadeAreas exist on

#

the script

thick veldt
#

wherever the colliders exist

#

since it sounds like you're going to be watching for the player entering and exiting these colliders

uncut bane
#

thats just why i was thinking of the tilemapcollider

#

Thanks for helping me though.. I know i am a bit frustrating.. to say the least

thick veldt
uncut bane
#

Right understood

thick veldt
#

a FadeArea is a FadeArea; that's it

uncut bane
#

[SerializeField] private FadeArea how would I reference it?

thick veldt
#

you'd want a List<FadeArea>

uncut bane
#

oh ok

thick veldt
#

then drag every relevant FadeArea into that list

#

here's what I'd do to decide if it's fading time

#

add using System.Linq; up top

#

then just do fadeAreas.Any(area => area.playerIsHere);

uncut bane
#

lanaguage integrated query

thick veldt
#

assuming the list is named fadeAreas

#

and that the FadeArea class has a field named playerIsHere

thick veldt
#

area => area.playerIsHere

#

all this does is get playerIsHere out of the area

#

it's the same as

#
bool IsThePlayerHere(FadeArea area) {
  return area.playerIsHere;
}
#

So, if one or more areas says "the player is here", that whole thing returns true

#

and you know it's time to fade the sprite out

uncut bane
#

Thank you, I appreciate you taking the time out to help me. I enjoy learning this stuff.. I used to know more.. but it is so much to remember.. been out of college for a long time lol

thick veldt
#

no prob :p

uncut bane
#

I'll make ya proud.

thick veldt
#

but yeah, the big idea here is separation of responsibility

uncut bane
#

what do you mean?

thick veldt
#

you have one class whose job is to look for the player and note that down

#

and a second class whose job is to do something if one or more of its areas says a player is there

uncut bane
#

listeners

#

right?

thick veldt
#

pretty much, yeah!

#

this is a bit more manual, since we're just checking a bool on the "sensor"

#

you could have the FadeSprites subscribe to events from FadeAreas

uncut bane
#

hopefully sometime I will somehow have a way I can repay the favor

thick veldt
#

maybe they'd count up how many times they've seen "enter" and "exit" messages and go back to solid when the numbers are equal

#

and nah, I like doing this. you just work on your game :p

uncut bane
#

Well you gave me a lot of stuff to think about. I'm sure you know how it is.. its like.. mush brain mush brain... then you get it..

#

then it clicks

#

Have a good night. I keep a list of people who have helped me, for future purposes. Take care