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.

46 lines
1.3KB

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. public class CalcerRandomDirection : CalcerVector
  7. {
  8. Axises axises;
  9. public CalcerRandomDirection(Axises axises)
  10. {
  11. this.axises = axises;
  12. }
  13. public override Vector3 value
  14. {
  15. get
  16. {
  17. float x = UnityEngine.Random.Range(-360.0F, 360.0F);
  18. float y = UnityEngine.Random.Range(-360.0F, 360.0F);
  19. float z = UnityEngine.Random.Range(-360.0F, 360.0F);
  20. switch (axises)
  21. {
  22. case Axises.x:
  23. return new Vector3(x, 0, 0);
  24. case Axises.y:
  25. return new Vector3(0, y, 0);
  26. case Axises.z:
  27. return new Vector3(0, 0, z);
  28. case Axises.xy:
  29. return new Vector3(x, y, 0);
  30. case Axises.xz:
  31. return new Vector3(x, 0, z);
  32. case Axises.yz:
  33. return new Vector3(0, y, z);
  34. case Axises.xyz:
  35. return new Vector3(x, y, z);
  36. default:
  37. return Vector3.zero;
  38. }
  39. }
  40. }
  41. }
  42. }