summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/Action/WaitForActionReachEnd.cs
blob: c2dd5f925b49480b170bf786862c79004f932e12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WaitForActionReachEnd : IEnumerator
{
	UnitAnimation m_UnitAnimation;
    int m_Layer;

    public WaitForActionReachEnd(UnitAnimation unitAnim, int layer = 0)
	{
		m_UnitAnimation = unitAnim;
        m_Layer = layer;
    }

	public object Current => null;

	public bool MoveNext()
	{
        var stateInfo = m_UnitAnimation.layers[m_Layer].stateInfo;
        float normalTime = stateInfo.normalizedTime;
        return normalTime < 1f;
	}

	public void Reset()
	{
	}
}