Ejemplo n.º 1
0
    public void startFight(ExploreCat enemy)
    {
        fadeSelector();
        ExploreCat cEnemy = getCurrentEnemy();
        ExploreCat user   = getCurrentUser();

        if (user == null || cEnemy == null)
        {
            return;
        }
        user.target = enemy;
        user.Enable();
        if (cEnemy.sideEffect != null)
        {
            cEnemy.checkRemoveEffect();
            if (cEnemy.sideEffect != null)
            {
                user.onHit = (AttackType a, ExploreCat c) =>
                {
                    controller.playSound(a);
                    cEnemy.Enable();
                    c.onHit = controller.OnHit;
                };
                return;
            }
        }
        if (!cEnemy.usedAction && EnemyAction(cEnemy))
        //&& UnityEngine.Random.value > 0.15f)
        {
            if (cEnemy.target == null)
            {
                cEnemy.findTarget();
            }
            user.onHit = (AttackType a, ExploreCat c) =>
            {
                controller.playSound(a);
                cEnemy.useAction();
                c.Disable();
                c.onHit = controller.OnHit;
            };
            return;
        }
        cEnemy.Enable();
    }