Beispiel #1
0
    public bool IADefense(Vector3 _position, float _efecto)
    {
        // obtener la probabilidad base de parada
        float baseProb = DifficultyService.GetProbabilidadBaseDeParada();//ServiceLocator.Request<IDifficultyService>().GetFase(), GameplayService.modoJuego.tipoModo);

        if (PowerupService.instance.IsPowerActive(Powerup.Destello))
        {
            baseProb -= 0.2f;
        }

        if (PowerupService.instance.IsPowerActive(Powerup.Phase))
        {
            baseProb -= 0.2f;
        }

        if (Habilidades.IsActiveSkill(Habilidades.Skills.Mago_balon) && Mathf.Abs(_efecto) > 0.65f)
        {
            baseProb -= 0.2f;
        }

        // modificador en la horizontal
        float hBonus = Mathf.Clamp01(Mathf.Abs(_position.x) / 3.5f);

        baseProb -= 0.05f * hBonus;

        // modificador en la vertical
        float vBonus = Mathf.Clamp01(Mathf.Abs(_position.y - 1.2f) / 1.1f);

        baseProb -= 0.05f * vBonus;

        // modificador por efecto
        baseProb -= 0.05f * Mathf.Abs(_efecto);

        baseProb = Mathf.Clamp01(baseProb);

        Debug.Log("Probabilidad de parada: " + baseProb + "(X " + hBonus + " Y " + vBonus + " E " + _efecto + ")");

        //aqui se decidiria si el portero coge o no la pelota (tirada de dado para resolver si la parada es efectiva)
        float rand    = Random.Range(0f, 1f);
        bool  success = rand < baseProb;

        //m_forcedResult = success ? GKResult.Good : GKResult.Fail;

        // forcedResult
        if (success)
        {
            m_forcedResult = (Random.Range(0f, 1f) < 0.25f) ? GKResult.Perfect : GKResult.Good;
        }
        else
        {
            m_forcedResult = GKResult.Fail;
        }
        return(success);
    }
Beispiel #2
0
 public void LoadDefense(Vector3 _info, GKResult _result)
 {
     info = ToDefenseInfoNet(_info, _result);
     if (PowerupService.instance.usedGoalkeeperPowerup)
     {
         info.powerupUsed = (int)PowerupService.instance.GoalkeeperPowerup;
     }
     else
     {
         info.powerupUsed = -1;
     }
 }
Beispiel #3
0
    public static DefenseInfoNet ToDefenseInfoNet(Vector3 _info, GKResult _result)
    {
        DefenseInfoNet infoN = new DefenseInfoNet();

        infoN.X         = _info.x;
        infoN.Y         = _info.y;
        infoN.Z         = _info.z;
        infoN.noDefense = _result == GKResult.Idle;
        infoN.perfect   = _result == GKResult.Perfect;
        infoN.success   = _result == GKResult.Good ||
                          _result == GKResult.Perfect;
        infoN.outOfBounds   = _result == GKResult.ThrowerFail;
        infoN.precisionFail = _result == GKResult.Fail;
        infoN.late          = _result == GKResult.Late;
        return(infoN);
    }
Beispiel #4
0
 public void SetupNetworkDefense(DefenseInfo _info)
 {
     m_futureDefense          = _info;
     m_forcedResult           = _info.Result;
     m_networkDefenseReceived = true;
 }