您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. public class CalcerFloat : Calcer<float>
  7. {
  8. private float internalValue;
  9. public CalcerFloat()
  10. {
  11. }
  12. public CalcerFloat(float value)
  13. {
  14. internalValue = value;
  15. }
  16. public CalcerFloat(int value)
  17. {
  18. internalValue = (float)value;
  19. }
  20. public CalcerFloat(double value)
  21. {
  22. internalValue = (float)value;
  23. }
  24. public override float value
  25. {
  26. get
  27. {
  28. return internalValue;
  29. }
  30. }
  31. public static implicit operator CalcerFloat(float val)
  32. {
  33. return new CalcerFloat(val);
  34. }
  35. public static implicit operator float(CalcerFloat calc)
  36. {
  37. return calc.value;
  38. }
  39. public static CalcerFloat operator +(CalcerFloat first, CalcerFloat second)
  40. {
  41. return new CalcerFloatCalc(first, second, CalcerFloatCalc.Operation.Add);
  42. }
  43. public static CalcerFloat operator -(CalcerFloat first, CalcerFloat second)
  44. {
  45. return new CalcerFloatCalc(first, second, CalcerFloatCalc.Operation.Sub);
  46. }
  47. public static CalcerFloat operator *(CalcerFloat first, CalcerFloat second)
  48. {
  49. return new CalcerFloatCalc(first, second, CalcerFloatCalc.Operation.Mul);
  50. }
  51. public static CalcerFloat operator /(CalcerFloat first, CalcerFloat second)
  52. {
  53. return new CalcerFloatCalc(first, second, CalcerFloatCalc.Operation.Div);
  54. }
  55. }
  56. }