Enemy Projectiles - Kelsey 11/8/23


We wanted the enemies to shoot the correct elemental projectile orbs based on which elemental monster they were. Part of this functionality was already done with the player projectile orb as there is a mechanic for changing which element the player is shooting. They way that the player's mechanic is done is by casting the player character from the orb to the third person character we use as the player. From there the third person character as an Enum that is switched on to change the color of certain variables with in the orb. The trail and sphere can have their colors changed from certain parameters that are set in their correlating materials and ns effects. 

I tried to use this same functionality with the enemy projectiles but was running into issues. The first was that I had to create a child of the player projectile elemental orb instead of working on a child of the basic player projectile orb because it wasn't allow the same functionality to work. The second was that I had to find a different way to cast to the different enemies instead of getting the player character, this came with another issue of not being able to use the third person character's Enum to switch on the elemental Enum. 

In order to be able to access the owner variable in the enemy projectile class I needed to set it in the enemy monster classes. So when overriding the attack function in each of the monster classes I had to set the owner. From there I can call the get owner function and get the class and use that to cast to the different enemy classes. This took away the need for the element Enum and instead I casted it to each of the different enemy classes. I then had to changed the current color to correlate with the monster element. In order to changed the trail and sphere I needed to set up the color and element parameters in the materials and the ns effect the same way it was done in the player projectile. After setting that up the enemy started shooting the correct color projectiles.




Get MystiMayhem

Leave a comment

Log in with itch.io to leave a comment.