Пример #1
0
        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);
                }
            }
        }
        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");
                    }
                }
            }
        }