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
|
@ -3,6 +3,8 @@ using UnityEngine;
|
||||||
|
|
||||||
public class Player : Mob {
|
public class Player : Mob {
|
||||||
|
|
||||||
|
Rigidbody2D body;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject bulletPrefab;
|
private GameObject bulletPrefab;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
|
@ -26,6 +28,7 @@ public class Player : Mob {
|
||||||
g.SetPrefab(bulletPrefab);
|
g.SetPrefab(bulletPrefab);
|
||||||
g.SetSpawn(bulletSpawn);
|
g.SetSpawn(bulletSpawn);
|
||||||
ggun = g;
|
ggun = g;
|
||||||
|
body = GetComponent<Rigidbody2D>();
|
||||||
SetAttack(s);
|
SetAttack(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +50,10 @@ public class Player : Mob {
|
||||||
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime();
|
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