Comments (3)
I added this to fix a bug. If the the enemy went to fire but the player moved out of target range, the value can get set to null before the enemy fires and causes a null exception. When this code executes it tries to access target.position with a null target and causes a null exception. This is a result of when firing the animation gets played than the animation tells when to actually fire based on its callback.
There are a few ways to fix this, but this seemed the simplest. I probably should have broke this fix out to a separate git commit so it could have explanation. Since the error was introduced as part of the functionality of syncing the animations with firing, i just included it with that commit.
from simpleincremental.
That makes sense. If we separate projectile firing from the animation it should eliminate this issue. We might want to revisit how projectiles fire. I'm still flip flopping on triggering projectile launch from the animation. I think a solution of "queueing" the projectile launch with its parameters at the start of the attack and "releasing" it via animation (so it's not doing a target check during the release portion) might work.
Also, rather than have a reloadTime that affects the coroutine to delay the projectile throwing, maybe we refactor it to attackSpeed and have speed affects the animator's Attack animation speed? Then we can have an "Attacking" bool parameter (instead of a trigger), and have the attack animation continue looping on itself while "Attacking" is true.
Does that make sense?
from simpleincremental.
You can do the same thing by changing the speed of the animation in code. My biggest concern with the separate coroutine is trying to sync them. The only way to tell would be to try and see what works better or has better drawbacks. Im guessing your trading independence from animation for syncing difficulties.
from simpleincremental.
Related Issues (18)
- Attack Speed is artificially capped for enemies. HOT 1
- Player Attack speed is artificially capped. HOT 1
- Allow enemies to boop the player more reliably.
- Make Player Movement Controller configurable via the Input manager
- Make lootchance item specific
- Migrate pausing functionality to a singleton GameSpeed manager
- Implement enemy difficulty scaling
- Simplify Projectile Launch Parameters
- Unify All Hud UI scripts into one
- Player Weapon / Enemy Weapon Layer documentation
- SpawnPoint.cs triggers off of anything colliding with its trigger, not just the player
- Extend the inventory system to allow multiple item types to be equipped
- PlayerStatsSystem's StatsChanged should be a C# Event and not a GameEvent
- Decouple Animator from PlayerMovementController
- Move the DisableInput functionality out of the PlayerMovementController and into a PlayerDeathHandler
- Remove horizontalSmoothing from PlayerMovementController
- Experience for next level doesn't update when PlayerLevel.LevelUp is called outsode of "GainExperience()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simpleincremental.