You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

68 lines
1.6KB

  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. }