public Initialize ( System.Numerics.Vector2 position, System.Numerics.Vector2 velocity, System.Numerics.Vector2 acceleration, float lifetime, float scaleX, float scaleY, float rotation, float rotationSpeed ) : void | ||
position | System.Numerics.Vector2 | |
velocity | System.Numerics.Vector2 | |
acceleration | System.Numerics.Vector2 | |
lifetime | float | |
scaleX | float | |
scaleY | float | |
rotation | float | |
rotationSpeed | float | |
return | void |
protected override void InitializeParticle(Particle particle, Vector2 where) { float velocity = Tools.RandomBetween(minInitialSpeed, maxInitialSpeed); float acceleration = Tools.RandomBetween(minAcceleration, maxAcceleration); float lifetime = Tools.RandomBetween(minLifetime, maxLifetime); float scaleX = Tools.RandomBetween(minScaleX, maxScaleX); float scaleY = Tools.RandomBetween(minScaleY, maxScaleY); float rotationSpeed = Tools.RandomBetween(minRotationSpeed, maxRotationSpeed); float rotation = Tools.RandomBetween(minRotationAngle, maxRotationAngle); Vector2 direction = PickDirection(rotation); particle.Initialize(where, velocity * direction, acceleration * direction, lifetime, scaleX, scaleY, rotation, rotationSpeed); }
// 使用设置好的值计算粒子的随机参数,然后初始化粒子 protected virtual void InitializeParticle(Particle particle, Vector2 where) { // 首先确定运动方向 Vector2 direction = PickDirection(); // 确定物理参数 float velocity = Tools.RandomBetween(minInitialSpeed, maxInitialSpeed); float acceleration = Tools.RandomBetween(minAcceleration, maxAcceleration); float lifetime = Tools.RandomBetween(minLifetime, maxLifetime); float scaleX = Tools.RandomBetween(minScaleX, maxScaleX); float scaleY = Tools.RandomBetween(minScaleY, maxScaleY); float rotationSpeed = Tools.RandomBetween(minRotationSpeed, maxRotationSpeed); float rotation = Tools.RandomBetween(minRotationAngle, maxRotationAngle); // 调用粒子的初始化方法 particle.Initialize(where, velocity * direction, acceleration * direction, lifetime, scaleX, scaleY, rotation, rotationSpeed); }
// 使用设置好的值计算粒子的随机参数,然后初始化粒子 protected virtual void InitializeParticle(Particle particle, Vector2 where) { // 首先确定运动方向 Vector2 direction = PickDirection(); // 确定物理参数 float velocity = Tools.RandomBetween(minInitialSpeed, maxInitialSpeed); float acceleration = Tools.RandomBetween(minAcceleration, maxAcceleration); float lifetime = Tools.RandomBetween(minLifetime, maxLifetime); float scaleX = Tools.RandomBetween(minScaleX, maxScaleX); float scaleY = Tools.RandomBetween(minScaleY, maxScaleY); float rotationSpeed = Tools.RandomBetween(minRotationSpeed, maxRotationSpeed); float rotation = Tools.RandomBetween(minRotationAngle, maxRotationAngle); // 调用粒子的初始化方法 particle.Initialize(where, velocity * direction, acceleration * direction, lifetime, scaleX, scaleY, rotation, rotationSpeed); }
protected override void InitializeParticle(Particle particle, Vector2 where) { float velocity = Tools.RandomBetween(minInitialSpeed, maxInitialSpeed); float acceleration = Tools.RandomBetween(minAcceleration, maxAcceleration); float lifetime = Tools.RandomBetween(minLifetime, maxLifetime); float scaleX = Tools.RandomBetween(minScaleX, maxScaleX); float scaleY = Tools.RandomBetween(minScaleY, maxScaleY); float rotationSpeed = Tools.RandomBetween(minRotationSpeed, maxRotationSpeed); float rotation = Tools.RandomBetween(minRotationAngle, maxRotationAngle); Vector2 direction = PickDirection(rotation); particle.Initialize(where, velocity * direction, acceleration * direction, lifetime, scaleX, scaleY, rotation, rotationSpeed); }