using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(Animator))] [RequireComponent(typeof(PlayerController))] public class StepBackScript : MonoBehaviour { private Animator animatorController; private PlayerController playerController; // Use this for initialization void Start () { playerController = GetComponentInParent<PlayerController>(); animatorController = GetComponent<Animator>(); } // Update is called once per frame private void Update() { if (playerController.isMyturn() && !playerController.isSkillUsing() && Input.GetKeyDown(playerController.controlType.getStepBackInput())) { activateSkill("stepBack"); } } private void stepBack() { playerController.updateMovementLockStates(); animatorController.SetTrigger("StepBack"); playerController.updateMovementLockStates(); } private void activateSkill(string method) { StopCoroutine("move"); StartCoroutine(method); } }