ObjectChangePositionCommand.cs 628 B

1234567891011121314151617181920212223242526
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace KairoEngine.Core
  5. {
  6. public class ObjectChangePositionCommand : ICommand
  7. {
  8. GameObject obj;
  9. Vector3 position;
  10. Quaternion rotation;
  11. public ObjectChangePositionCommand(GameObject obj, Vector3 position, Quaternion rotation)
  12. {
  13. this.obj = obj;
  14. this.position = position;
  15. this.rotation = rotation;
  16. }
  17. public void Execute()
  18. {
  19. obj.transform.position = position;
  20. obj.transform.rotation = rotation;
  21. }
  22. }
  23. }