IEnumerator TargetAnimation(GameObject pos, CharacterLane lane, CardData data, CardAction action) { if (action.Source == null) { yield break; } var initialPos = action.Source.gameObject.transform.GetChild(0).gameObject.transform.position; iTween.MoveTo(action.Source.gameObject.transform.GetChild(0).gameObject, iTween.Hash("position", pos.transform.position, "easeType", "easeInQuart", "time", 0.5f)); iTween.MoveTo(action.Source.gameObject.transform.GetChild(0).gameObject, iTween.Hash("position", initialPos, "time", 0.5f, "delay", 0.5f)); yield return(StartCoroutine(ExecuteWithCoroutine(lane, data, waitTimeBetweenActions / 2))); }
IEnumerator SelfAnimation(CharacterLane lane, CardData data, CardAction action) { if (action.Source == null) { yield break; } var initialPos = action.Source.gameObject.transform.GetChild(0).gameObject.transform.position; iTween.MoveTo(action.Source.gameObject.transform.GetChild(0).gameObject, iTween.Hash( "position", new Vector3(initialPos.x, initialPos.y + .3f, initialPos.z), "time", 0.25f)); iTween.MoveTo(action.Source.gameObject.transform.GetChild(0).gameObject, iTween.Hash("position", initialPos, "time", 0.25f, "delay", 0.25f)); yield return(StartCoroutine(ExecuteWithCoroutine(lane, data, waitTimeBetweenActions / 4))); }
private IEnumerator ExecuteWithCoroutine(CharacterLane lane, CardData data, float time) { yield return(new WaitForSeconds(time)); lane.ExecuteAction(data); }