No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
Este repositorio está archivado. Puede ver los archivos y clonarlo, pero no puede subir cambios o reportar incidencias ni pedir Pull Requests.

CalcerVectorCalc.cs 1.0KB

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