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.

56 lines
2.0KB

  1. using UnityEngine;
  2. using System.Collections;
  3. using coa4u;
  4. public class ActorSampleActions : Actor
  5. {
  6. public void Start()
  7. {
  8. ActionInstant seq = new ActionRepeat (new ActionSequence(new ActionInstant[]
  9. {
  10. new ActionFadeIn(2),
  11. new ActionParallel(new ActionInstant[] {
  12. new ActionMoveBy(new Vector3(10, 10, 0), 1),
  13. new ActionRotateBy(new Vector3(90, 90, 0), 1),
  14. new ActionTintBy(new Vector4(-50, 50, -150), 1)
  15. }),
  16. new ActionScaleBy(new Vector3(2, 2, 1), 1),
  17. new ActionScaleBy(new Vector3(0.5F, 0.5F, 2), 1),
  18. new ActionDelay(1),
  19. new ActionBlink(5, 0.1F, 0.4F),
  20. new ActionDelay(1),
  21. new ActionSkewBy(Vector3.zero, new Vector3(0, 30, 0), 1),
  22. new ActionDelay(1),
  23. new ActionJumpBy(new Vector3(-10, 0, 0), 1, 4, 1),
  24. new ActionSkewBy(Vector3.zero, new Vector3(30, 0, 30), 1),
  25. new ActionJumpTo(new Vector3(10, 10, 10), 1, 3, 1),
  26. new ActionRotateBy(new Vector3(90, 0, 0), 1),
  27. new ActionSkewBy(Vector3.zero, new Vector3(-30, 0, -30), 1),
  28. new ActionJumpBy(new Vector3(-10, 0, 0), 1, 2, 1),
  29. new ActionSkewBy(Vector3.zero, new Vector3(0, -30, 0), 1),
  30. new ActionDelay(0.5F),
  31. new ActionBezierRel(new Vector2 (5, 0), new Vector2(5, -10), new Vector2 (0, -10), 2),
  32. new ActionScaleTo(new Vector3(2, 2, 2), 1),
  33. new ActionRotateTo(new Vector3(0, 0, 0), 1),
  34. new ActionFadeOut(2),
  35. new ActionSetTint(new Vector4(67, 105, 181)),
  36. new ActionSendMessage("msgHello"),
  37. new ActionSendMessage("msgHelloTo", "world"),
  38. }), 5);
  39. this.AttachAction(seq);
  40. AddMethodToCache(new MethodHolder(msgHello));
  41. AddMethodToCache(new MethodHolder<string>(msgHelloTo));
  42. }
  43. void msgHello()
  44. {
  45. Debug.Log("Hello!");
  46. }
  47. void msgHelloTo(string who)
  48. {
  49. Debug.Log("Hello " + who.ToString() + "!");
  50. }
  51. }