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.

SeqTest.cs 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using coa4u;
  5. [System.Serializable]
  6. public class SeqTest : SeqActor
  7. {
  8. public Actor enemy;
  9. Vector3 startPosition;
  10. void Start()
  11. {
  12. startPosition = transformCached.position;
  13. CalcerVector endPosition = new CalcerPosition(enemy) + new CalcerVector(new Vector3(-2F, transformCached.position.y, 0F));
  14. ActionInstant stateDefault = new ActionSequence(
  15. new ActionInstant[]
  16. {
  17. new ActionDelay(3),
  18. new ActionSwitchState(1)
  19. });
  20. ActionInstant stateRoam = new ActionSequence(
  21. new ActionInstant[] {
  22. new ActionHolder<ActionSetDirection>(new CalcerPosition(enemy)),
  23. new ActionHolder<ActionJumpTo>(endPosition, 5, 1, 1),
  24. new ActionDelay(0.5F),
  25. new ActionHolder<ActionMoveTo>(new CalcerPosition(enemy), 0.1F),
  26. new ActionHolder<ActionMoveTo>(endPosition, 0.1F),
  27. new ActionDelay(0.5F),
  28. new ActionJumpTo(startPosition, 5, 1, 1),
  29. new ActionSwitchState(0)
  30. });
  31. states = new State[]
  32. {
  33. new State(stateDefault, "wait"),
  34. new State(stateRoam, "attack")
  35. };
  36. SetState(0);
  37. }
  38. }