Weapos Rejiggered
Modified weapon scripts to eliminate specialized projectile behavior - allows charged weapons to have projectiles and modify weapon stats when charged Added machine gun weapon & VFX Moved third party code to Plugins folder to improve compile times
This commit is contained in:
parent
2a0fe34611
commit
dbc522a224
2105 changed files with 7033 additions and 1141 deletions
|
|
@ -42,8 +42,11 @@ public class Projectile : MonoBehaviour
|
|||
|
||||
if(_alive)
|
||||
{
|
||||
var position = transform.position;
|
||||
var t = transform;
|
||||
var position = t.position;
|
||||
Velocity += Vector3.up * (Gravity * Time.deltaTime);
|
||||
var forward = Velocity.normalized;
|
||||
t.forward = forward;
|
||||
var ray = new Ray(position, Velocity);
|
||||
if (Physics.Raycast(ray, out var hit, Velocity.magnitude * Time.deltaTime, 1))
|
||||
{
|
||||
|
|
@ -52,7 +55,7 @@ public class Projectile : MonoBehaviour
|
|||
{
|
||||
if (hull.Entity != SourceEntity)
|
||||
{
|
||||
hull.SendHit(Damage, Penetration, Spread, DamageType, SourceEntity, hit, Velocity.normalized);
|
||||
hull.SendHit(Damage, Penetration, Spread, DamageType, SourceEntity, hit, forward);
|
||||
transform.position = hit.point;
|
||||
StartCoroutine(Kill());
|
||||
}
|
||||
|
|
@ -62,6 +65,14 @@ public class Projectile : MonoBehaviour
|
|||
StartCoroutine(Kill());
|
||||
return;
|
||||
}
|
||||
|
||||
if (HitEffect != null)
|
||||
{
|
||||
var ht = HitEffect.Instantiate<Transform>();
|
||||
ht.SetParent(hit.collider.transform);
|
||||
ht.position = hit.point;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
transform.position += Velocity * Time.deltaTime;
|
||||
|
|
|
|||
Loading…
Reference in a new issue