Example #1
0
    public IEnumerator Execute()
    {
        while (Vector2.Distance(m_trans.position, targetTrans.position) < m_entity.AttackRange)
        {
            m_entity.Attack();
            Debug.Log("bite!" + Time.time);

            // or set attack cool down here
            yield return(new WaitForSeconds(m_entity.AttackCoolDown));

            //yield return null;
        }

        this.ExitToNextState();
    }