25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
Bu depo arşivlendi. Dosyaları görüntüleyebilir ve klonlayabilirsiniz ama işlem gönderemez ve konu/değişiklik isteği açamazsınız.

41 satır
912B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. class ActionSwitchState : ActionInstant
  7. {
  8. string stateName;
  9. int stateIndex;
  10. public ActionSwitchState(int targetIndex)
  11. : base()
  12. {
  13. stateIndex = targetIndex;
  14. }
  15. public ActionSwitchState(string targetName)
  16. : base()
  17. {
  18. stateName = targetName;
  19. }
  20. public override void Start()
  21. {
  22. base.Start();
  23. if (!(target is SeqActor))
  24. {
  25. throw new Exception("Target is not capable of switching states.");
  26. }
  27. if (stateIndex != null)
  28. {
  29. ((SeqActor)target).SetState(stateIndex);
  30. }
  31. else
  32. {
  33. ((SeqActor)target).SetState(stateName);
  34. }
  35. }
  36. }
  37. }