#tiles and entities

1 messages · Page 1 of 1 (latest)

timid smelt
#

then like a BaristaCharacter : Character or something

spring sphinx
#

yes, and Character : Entity

#

whereas it can be CoffeeSpill : TemporaryEffect TemporaryEffect : Decoration, StaticObject : Entity

#

however it might be rendered as a tile

timid smelt
#

So it would be

Entity

  • Tile
    - GrassTile
  • Character
    - BaristaCharacter
spring sphinx
#

yeah

#

ou sort of have this already!

#

i think you are already doing something similar

timid smelt
#

i just have the EntityBase atm

spring sphinx
#

maybe you have composed scripts

timid smelt
#

which is

spring sphinx
#

it is okay to also do

timid smelt
#

Variables

        public Sprite EntitySprite;

    public string EntityName;

    public int EntityZIndex;

    public Material defaultMat;

    public TileContainer myContainer;
    public GameObject myContainerGO;

    public Grid myGrid;

    public bool isTerrain = false;

    public Vector2Int EntityPosition;
    public EntityDirections EntityDirection;
spring sphinx
#

gameobject

  • entity
  • tile
  • grass
#

as your grass tile prefab

timid smelt
#

ok lemme just share you the notion doc

#

lol

#

😐

spring sphinx
#

maybe they blocked all URLs

timid smelt
#

i posted it in general by accident

#

then deleted it

spring sphinx
#

just paste it into a ``

timid smelt
#

https://tarry-salamander-64d.notion.site/EntityBase-Object-04f71006506e41439c0131e3f862a00c

spring sphinx
#

okay i understand now

#

so the essential change you should make is separate the stuff for rendering (like the sprite rules) from the stuff for running the simulation (like the positions)

#

some stuff is both useful for rendering and game rules, like the positions

#

that should stay

#

but if it's exclusively rendering, pull it out

#

that might mean you wind up with a component for all the rendering details

#

or you can use an interface - interfaces are basically a way to give another view of your entities, like another way your rendering code can "just" iterate through every entity and make a decision on how to show it in the game

timid smelt
#

so from this it should be

spring sphinx
#

adding another component to your prefab and doing GetComponent<T> is the same as adding an interface

timid smelt
#

so it would be rendering vs simulation properties that would need to be delegated and such?

spring sphinx
#

that seems to make the most sense to me

#

and would reduce the pain for you the most

#

for example maybe you just want to put something in the simulation and have it log to console for now

#

and then you can deal with building a UI around it later

#

like TownLaw

#

i think this addresses how you are feeling about the burden of adding new functionality

#

right now you are making yourself write a lot of code to just say, "no i don't wanna render this right now, i haven't figured that out yet"

#

maybe we cracked this nut