6 namespace droid.Runtime.Prototyping.Actuators.Particles {
10 [AddComponentMenu(ActuatorComponentMenuPath._ComponentMenuPath
12 + ActuatorComponentMenuPath._Postfix)]
13 [RequireComponent(typeof(ParticleSystem))]
14 [RequireComponent(typeof(Rigidbody))]
19 bool _fired_this_step;
29 public override string PrototypingTypeName {
get {
return "Rocket" + this._Axis_Of_Motion; } }
34 protected override void Setup() {
35 this._Rigidbody = this.GetComponent<Rigidbody>();
36 this._Particle_System = this.GetComponent<ParticleSystem>();
37 var valid_input = this.MotionSpace;
38 valid_input._Min_Value = 0;
39 this.MotionSpace = valid_input;
45 if (this._fired_this_step) {
46 if (!this._Particle_System.isPlaying) {
47 this._Particle_System.Play(
true);
50 this._Particle_System.Stop(
true);
53 this._fired_this_step =
false;
61 if (motion.
Strength <
this.MotionSpace._Min_Value || motion.
Strength >
this.MotionSpace._Max_Value) {
62 Debug.Log($
"It does not accept input {motion.Strength}, outside allowed range {this.MotionSpace._Min_Value} to {this.MotionSpace._Max_Value}");
66 switch (this._Axis_Of_Motion) {
68 if (this._Relative_To == Space.World) {
69 this._Rigidbody.AddForce(Vector3.left * motion.
Strength);
71 this._Rigidbody.AddRelativeForce(Vector3.left * motion.
Strength);
76 if (this._Relative_To == Space.World) {
77 this._Rigidbody.AddForce(Vector3.up * motion.
Strength);
79 this._Rigidbody.AddRelativeForce(Vector3.up * motion.
Strength);
84 if (this._Relative_To == Space.World) {
85 this._Rigidbody.AddForce(Vector3.forward * motion.
Strength);
87 this._Rigidbody.AddRelativeForce(Vector3.forward * motion.
Strength);
92 if (this._Relative_To == Space.World) {
93 this._Rigidbody.AddTorque(Vector3.left * motion.
Strength);
95 this._Rigidbody.AddRelativeTorque(Vector3.left * motion.
Strength);
100 if (this._Relative_To == Space.World) {
101 this._Rigidbody.AddTorque(Vector3.up * motion.
Strength);
103 this._Rigidbody.AddRelativeTorque(Vector3.up * motion.
Strength);
108 if (this._Relative_To == Space.World) {
109 this._Rigidbody.AddTorque(Vector3.forward * motion.
Strength);
111 this._Rigidbody.AddRelativeTorque(Vector3.forward * motion.
Strength);
115 case Axis.Dir_x_:
break;
116 case Axis.Dir_y_:
break;
117 case Axis.Dir_z_:
break;
118 default:
throw new ArgumentOutOfRangeException();
121 this._fired_this_step =
true;
override void InnerApplyMotion(IMotion motion)
ParticleSystem _Particle_System