Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
Це архівний репозитарій. Ви можете переглядати і клонувати файли, але не можете робити пуш або відкривати питання/запити.

45 рядки
1014B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. /// <summary>
  7. /// Instantly moves the target to the given point.
  8. /// </summary>
  9. class ActionSetPlace : ActionInstant
  10. {
  11. protected Vector3 value;
  12. public ActionSetPlace(Vector3 tgtPlace)
  13. : base()
  14. {
  15. value = tgtPlace;
  16. }
  17. public ActionSetPlace(Vector2 tgtPlace)
  18. : this((Vector3)tgtPlace)
  19. {
  20. is2d = true;
  21. }
  22. /// <summary>
  23. /// Returns a copy of the action.
  24. /// </summary>
  25. public override ActionInstant clone()
  26. {
  27. return new ActionSetPlace(value);
  28. }
  29. /// <summary>
  30. /// This method is called at the action start.
  31. /// </summary>
  32. public override void start()
  33. {
  34. base.start();
  35. if (is2d)
  36. value.z = transform.position.z;
  37. transform.position = value;
  38. }
  39. }
  40. }