Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How do I create a list of GameObjects & Integers?

$
0
0
Alright, so- first of all, I'd like to apologize because I'm not the most patient with tutorials and I'm a little rusty with Unity. The scenario is, I want to create a system where enemy "guards" will explore a list of rooms for the player- prioritizing rooms they haven't explored in a while. I figured a way to do this was to have each Guard assign a number to each room, and increase that number while they are inside it and decrease it when they're outside it. That way, to get to the least explored room all they'd have to do is go to the room with the highest number on it (and if a guard spots a player, you could increase the number of that room so it prioritises searching that area). For references sake I refer to this number as the rooms "temperature", a guard will always go to the hottest room in order to cool it down. So, I follow the Navmesh tutorial, bake the maze, and make a basic enemy that can navigate the maze to a target- so I figure all I need is a way to set the current target to the floor of the room the guard needs to go to and I'm good. So I tag all the floors and have a script that can find objects with that tag. I think what I need is an array or list that holds all the rooms (there are only 9 rooms in a 3x3 grid separated by walls) as well as an integer for each room that I can increment. I've tried looking up tutorials for arrays (which are apparently outdated), lists and structures for a way of doing this. It's possible I'm not using the correct method since the main problem I'm having is trying to combine several tutorials which results in errors- so I'm not entirely sure where to start for this specific problem. I'd appreciate any help whatsoever, this is for a college project I'm working on.

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>