Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

41 lignes
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. }