public void dealDamage(GameObject attacker)
        {
            GameObject[] enemies = EnemyUtil.GetEnemies();

            foreach (GameObject enemy in enemies)
            {
                float distance = Vector3.Distance(attacker.transform.position, enemy.transform.position);

                if (distance < 2.0f)
                {
                    enemy.GetComponent <Swordsmanship.SwordsmanCharacter>().BeHit(attacker, 160);
                }
            }
        }
        // face enemy
        public void FaceEnemy()
        {
            GameObject obj = EnemyUtil.FindLockEnemy(transform);

            if (obj == null)
            {
                return;
            }

            Vector3 error = obj.transform.position - transform.position;

            error.y = 0;

            float desiredAngle = Mathf.Atan2(error.x, error.z) * 180.0f / Mathf.PI;

            transform.localRotation = Quaternion.Euler(0, desiredAngle, 0);
            //Quaternion.Slerp(transform.localRotation, Quaternion.Euler(0,desiredAngle,0),Time.deltaTime * 10);
        }
        IEnumerator damage()
        {
            GameObject[] enemies = EnemyUtil.GetEnemies();

            for (int i = 0; i < 3; ++i)
            {
                yield return(new WaitForSeconds(1));

                foreach (GameObject enemy in enemies)
                {
                    Swordsmanship.SwordsmanCharacter c = enemy.GetComponent <Swordsmanship.SwordsmanCharacter>();

                    if (c)
                    {
                        c.BeHit(attacker, 160);
                        Debug.Log("flag");
                    }
                }
            }
        }
        protected bool LockEnemyRotation()
        {
            GameObject obj = EnemyUtil.FindLockEnemy(playerObj.transform);

            if (obj == null)
            {
                return(false);
            }

            Vector3 error = obj.transform.position - transform.position;

            error.y = 0;

            float desiredAngle = Mathf.Atan2(error.x, error.z) * 180.0f / Mathf.PI;

            m_LookAngle             = Mathf.LerpAngle(m_LookAngle, desiredAngle, Time.deltaTime * m_TurnSpeed);
            m_TransformTargetRot    = Quaternion.Euler(0f, m_LookAngle, 0f);
            transform.localRotation = m_TransformTargetRot;

            return(true);
        }
 // Use this for initialization
 void Start()
 {
     enemyUtil = GameObject.Find("EnemyUtilityObj").GetComponent <EnemyUtil> ();
 }