Skip to content

COP_pool_manager_local_template

Kamran Wali edited this page Dec 2, 2024 · 3 revisions

Inherits: pool_local

Node template script for creating new scripts containing all the local pool object manager methods and properties.

Description

COP_pool_manager_local_template is a Node template script. You can use this template script to create new scripts/objects that will act as local pool object managers. You can also add these methods and properties to your script to make your script into a pool object manager. It is the methods and properties that makes a script to a pool object manager. Local pool object manager means that the update manager property is referenced by dragging and dropping a node object that contains the base_update_manager script.

Tutorial

Methods

Return Type Name
void update( float delta )
void _p_setup_object_pool()
bool _p_is_pool_object( Node object )
bool _p_is_pool_object_available( Node object )

Method Descriptions

void update ( float delta )

This is the method that will be called per frame. Any update frame logic MUST be put here.

Note: It is recommended to call the parent's update function first. There is already pre-existing logic that handles that. Just put your logic after them.


void _p_setup_object_pool ()

This method sets up the pool objects. There is a pre-existing logic that already handles the setup of pool objects. If you need other logic to work with the pre-existing one then it is suggested to write those logic after the pre-existing one.

Note: If you want to set up the pool objects in your own way at start up then you can do so here. If you do do so then you can remove the pre-existing logic which calls the parent's default way of setting up the pool objects. Also make sure to clear the _p_objects array so that multiple similar pool objects are NOT added.


bool _p_is_pool_object ( Node object )

This method checks if the object is a pool object. There is already a pre-existing logic that checks if an object is a pool object.

Note: You can change the condition for checking if an object is a pool object. It is recommended to use the parent's default way to check if an object is pool object as that is the fastest way to do the check. But if you want to set some other way to validate then you can do so here. The property _p_objects contains all the pool objects or should be added to. The property _p_index_object is the loop counter.


bool _p_is_pool_object_available ( Node object )

This method checks if the pool object is available. There is already pre-existing logic that checks if a pool object is available.

Note: You can give conditions to check if a pool object is ready to be used. The object provided in the parameter is a pool object.


Clone this wiki locally