Esempio n. 1
0
    private void Attack()
    {
        int enemyNum = EnemyCtrs.Count;

        if (enemyNum > 0)
        {
            for (int i = 0; i < EnemyCtrs.Count; i++)
            {
                PlayerCtr item = EnemyCtrs[i];
                if (item.HP > 0)
                {
                    item.TakeDamage(ATK);
                }
                if (item.HP <= 0)
                {
                    EnemyCtrs.Remove(item);
                }
            }
        }
        else
        {
            StopAttack();
            Ctr.MoveInstance.PauseMove(false);
        }
    }
Esempio n. 2
0
    private void OnCollisionEnter(Collision collision)
    {
        Transform tr = collision.transform;
        PlayerCtr pc = tr.GetComponentInParent <PlayerCtr>();

        if (pc != null)
        {
            Direction dir = Utils.GetDirection(transform, tr);
            Debug.Log(transform.parent.name + "===" + dir.ToString());
            Ctr.MoveInstance.PauseMove(true);

            EnemyCtrs.Add(pc);
            if (!InWar)
            {
                InvokeRepeating("Attack", 0f, 1f);
            }
        }
    }
Esempio n. 3
0
 public void Init()
 {
     EnemyCtrs.Clear();
     InWar = false;
 }