Completion Detection System for Unique Tasks
One of the core components of Not so Trash Panda is the completion of various tasks. With there being several tasks with different requirements, this meant that having one single script for them to work off was not going to work. Due to this, I had to start using Baseclass scripts, something that (at the time) I was not comfortable doing.
Baseclass Scripts
For the uninitiated, Baseclass scripts allow you to make several different scripts that a sort of branches from a single core script. This was especially useful here since I was able to make a baceclass for task detection. This baseclass contains variables for interacting with a UI component that functions as a task list. There is also a method that is called when a task is completed, and this will be called in the various scripts that derive from this baseclass. This script also contains a method called EffectsInWorld, which can be overridden to have an effect in the game, such as placing an object down.
Example of Inherited Script
An example of one of these scripts is TaskDetectionMulti, which is used for a task that requires multiple objects to be placed into a detector zone. This script uses a gameobject array variable for the objects that are associated with the task, as well as a boolean array that associates with each object in the previously mentioned array. This boolean is turned on depending on the object that was placed in the detector zone. Once all of the objects are placed in the zone, the task will be marked as completed.
Using Inherited Scripts as Baseclass
For another example of using baseclass scripts, I had to make an inherited script into a baseclass when making the doghouse task detector script. In this case, the doghouse script inherits off of the TaskDetectionSingle script, which inherits off of the BaseClassTaskDetection. The doghouse script is different from the TaskDetectionSingle in the sense that it removes the zone that prevents you from moving forward. For the sake of visualization, I made the blocking zone a transparent blue to see how the task works.
All of that said, the point is that this task detection system would be much more frustrating not only to program, but also to set up in the editor. Being able to use Baseclass scripts has been a lifesaver during this task (haha), and I am very grateful for being able to use them.
Get Not so Trash Panda
Not so Trash Panda
You're a raccoon just trying to do the right thing.
Status | Released |
Authors | Dylon999, jojoman941, LauraG914, slleggott, Navebackwards, Lord Unchemael |
Genre | Puzzle |
Tags | Casual, Cute |
More posts
- How To Throw ObjectsJul 23, 2024
- Using empty game objects as target points.Jul 22, 2024
- Common Mistakes when coding GamesJul 15, 2024
- 2D Art and UIJul 08, 2024
- How to make a water sprinkler with unity's Visual ScriptingJul 08, 2024
- What is Not so Trash Panda?Jul 01, 2024
- How to: Cloud ShadowsJun 25, 2024
- How to pick up ObjectsJun 18, 2024
- Creating the Cute Protagonist for Our GameJun 10, 2024
Leave a comment
Log in with itch.io to leave a comment.