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.

43 lines
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. public class CalcerVectorCalc : CalcerVector
  7. {
  8. public enum Operation
  9. {
  10. Add,
  11. Sub
  12. }
  13. private Operation operation;
  14. private CalcerVector first;
  15. private CalcerVector second;
  16. public CalcerVectorCalc(CalcerVector first, CalcerVector second, Operation operation = Operation.Add)
  17. {
  18. this.first = first;
  19. this.second = second;
  20. this.operation = operation;
  21. }
  22. public override Vector3 value
  23. {
  24. get
  25. {
  26. switch (operation)
  27. {
  28. case Operation.Add:
  29. return first.value + second.value;
  30. case Operation.Sub:
  31. return first.value - second.value;
  32. default:
  33. throw new Exception("Operation not found.");
  34. }
  35. }
  36. }
  37. }
  38. }