public void Execute(ref ControlTorqueAngular controlTorqueAngular, ref ShipTorqueControl shipTorqueControl, [ReadOnly] ref ShipControlInfo shipControlData, [ReadOnly] ref ShipMoveInput shipMoveInput, [ReadOnly] ref ActorAttribute1 <_VelocityLevel> shipVelocity) { if (shipMoveInput.lost) { shipTorqueControl.noControlTorqueTime = 0f; controlTorqueAngular.torque = 0f; return; } var velocityLevel = (int)shipVelocity.value; //velocityLevel += 1; var velocity = shipControlData.getVelocity(velocityLevel); var torqueY = math.clamp(shipMoveInput.torqueY, -1f, 1f); //out controlTorqueAngular.torque = velocity.torque; if (torqueY != 0f) { shipTorqueControl.noControlTorqueTime = shipTorqueControl.noControlTorqueBeginTime; } else { controlTorqueAngular.torque *= shipTorqueControl.noControlTorqueTime; shipTorqueControl.noControlTorqueTime -= fixedDeltaTime; shipTorqueControl.noControlTorqueTime = math.clamp(shipTorqueControl.noControlTorqueTime, 0f, 1f); } controlTorqueAngular.maxTorque = velocity.maxTorque; controlTorqueAngular.angular = new float3 { y = torqueY }; }
public void Execute(ref ActorAttribute3 <_Power> attribute3, ref ControlForceDirection controlForceDirection, ref ControlTorqueAngular controlTorqueAngular) { var scale = 1f; if (controlForceDirection.force > 0f) { scale -= 0.5f; } if (controlTorqueAngular.torque > 0f) { scale -= 0.25f; } #if ENABLE_UNITY_COLLECTIONS_CHECKS if (attribute3.regain < 0f) { throw new System.Exception("attribute3.regain < 0f"); } #endif //value attribute3.value += attribute3.regain * scale * fixedDeltaTime; if (attribute3.value >= attribute3.max) { attribute3.value = attribute3.max; } }