hackerspace-ntnu / hackerspace-ntnu/Red-Planet-Rampage
Refactor projectile initialization
- Dominant language
- C#
- Stars
- 32
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently we have duplicate code that does (among other things)
```cs
projectile.active = true;
projectile.distanceTraveled = 0f;
projectile.damage = stats.ProjectileDamage;
projectile.position = projectileOutput.position;
projectile.oldPosition = projectileOutput.position;
projectile.direction = projectileRotation * projectileOutput.forward;
projectile.maxDistance = this.maxDistance;
projectile.rotation = projectileRotation * projectileOutput.rotation;
projectile.initializationTime = Time.fixedTime;
projectile.speedFactor = stats.ProjectileSpeedFactor;
projectile.gravity = stats.ProjectileGravityModifier * 9.81f;
projectile.additionalProperties.Clear();
projectile.hitHealthControllers.Clear();
```
in the override for `InitializeProjectile`.
A bunch of this should be the same for all cases (e.g. damage, position, direction), and everything should behave predictably so that we can apply various funky rotations and so on without worrying about someone writing the initialization code for a new barrel _slightly_ wrong and breaking an extension in the process.
Contributor guide
Assessment
This issue has not been assessed yet.