change player particle emmision to scale by speed
This commit is contained in:
parent
e81f7808d7
commit
35a3c21c91
1 changed files with 7 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class Player : Mob {
|
||||
|
||||
Rigidbody2D body;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject bulletPrefab;
|
||||
|
@ -26,6 +28,7 @@ public class Player : Mob {
|
|||
g.SetPrefab(bulletPrefab);
|
||||
g.SetSpawn(bulletSpawn);
|
||||
ggun = g;
|
||||
body = GetComponent<Rigidbody2D>();
|
||||
SetAttack(s);
|
||||
}
|
||||
|
||||
|
@ -47,6 +50,10 @@ public class Player : Mob {
|
|||
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime();
|
||||
}
|
||||
}
|
||||
float velocity = body.velocity.magnitude;
|
||||
ParticleSystem.EmissionModule emission = GetComponentInChildren<ParticleSystem>().emission;
|
||||
emission.rateOverTime = velocity * (velocity / 2) * 20 + 20;
|
||||
Debug.Log(emission.rateOverTime.constant);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue