[Game of Purpose] Day 46 – Simple Battery System

Today I implemented a simple battery system. It has a status indicator in the top right corner. It has a configurable rate of depletion and automatically turns the engine off when it runs out of power.

First I create a BPC_Drone_Battery componen…


This content originally appeared on DEV Community and was authored by Maciej Sawicki

Today I implemented a simple battery system. It has a status indicator in the top right corner. It has a configurable rate of depletion and automatically turns the engine off when it runs out of power.

A 3D rendered scene showing a drone on a grid-patterned platform, with a clear sky and simple geometric structures in the background. The interface indicates

First I create a BPC_Drone_Battery component. It has an event DrainTick called every TickEvery amount of time and calls a Drain Charge function.

Image description

Drain Charge function simply takes Drain Per Tick away from a total charge and calls Update Charge. It does nothing when the battery is off.

Image description

Update Charge updates the Charge variable and calls events: Battery Charge Changed or when it drops to zero Battery Charge Depleted.

Image description


This content originally appeared on DEV Community and was authored by Maciej Sawicki


Print Share Comment Cite Upload Translate Updates
APA

Maciej Sawicki | Sciencx (2024-07-03T22:06:20+00:00) [Game of Purpose] Day 46 – Simple Battery System. Retrieved from https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/

MLA
" » [Game of Purpose] Day 46 – Simple Battery System." Maciej Sawicki | Sciencx - Wednesday July 3, 2024, https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/
HARVARD
Maciej Sawicki | Sciencx Wednesday July 3, 2024 » [Game of Purpose] Day 46 – Simple Battery System., viewed ,<https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/>
VANCOUVER
Maciej Sawicki | Sciencx - » [Game of Purpose] Day 46 – Simple Battery System. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/
CHICAGO
" » [Game of Purpose] Day 46 – Simple Battery System." Maciej Sawicki | Sciencx - Accessed . https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/
IEEE
" » [Game of Purpose] Day 46 – Simple Battery System." Maciej Sawicki | Sciencx [Online]. Available: https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/. [Accessed: ]
rf:citation
» [Game of Purpose] Day 46 – Simple Battery System | Maciej Sawicki | Sciencx | https://www.scien.cx/2024/07/03/game-of-purpose-day-46-simple-battery-system/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.