public bool loadBananas2(int _nrLvl) { int _hwMnOpponents = _nrLvl % 10; if (_hwMnOpponents == 0) { _hwMnOpponents = 10; } hwMnBananas = _hwMnOpponents + 1; opponent = new GameObject[_hwMnOpponents + 1]; for (int i = 0; i < _hwMnOpponents + 1; i++) { opponent[i] = Instantiate(opponentPre); setBananaParameters(opponent[i], true); EnemyManager4 tmpEnemyMgr = opponent[i].GetComponent <EnemyManager4>(); tmpEnemyMgr.setCurves(track[actualTrack].GetComponent <TrackManager>().getSensors()); opponent[i].transform.position = startingPlaces[i]; opponent[i].transform.rotation = startingPlacesRotation[i]; tmpEnemyMgr.setMiddleBell(raceIntMngr.getMiddleBell()); tmpEnemyMgr.setBananaStartingNr(i); if (i == _hwMnOpponents) { tmpEnemyMgr.setDriverPlayerFL(true); setBananaParameters(opponent[i], false); opponent[i].GetComponent <EnemyManager4>().setAudioListener(true); } tmpEnemyMgr.setRoadFacture(actualTrackRoadFacture); tmpEnemyMgr.setGraphicsOptionsSetings(optionsDustOnRoadFL, optionsTraceOfTiresFL, optionsTraceOfTiresColorLightFL); tmpEnemyMgr.setAudioMotorFL(optionsSoundsFL); tmpEnemyMgr.setHelperGameObjectsMgr(helperGameObjectsMgr); float tmpDeltaTraceOfTiresColorDark = playerData.getDeltaTraceOfTiresColorDarkRandom(); tmpEnemyMgr.setDeltaTraceOfTiresColorDark(tmpDeltaTraceOfTiresColorDark); } firstOpponentFL = true; return(true); }
bool setBananaParameters(GameObject banan, bool isOpponentFL) { EnemyManager4 bananMngr = banan.GetComponent <EnemyManager4>(); float tmpLvlTypeNr = Mathf.Floor((actualLvl - 1) / 10) + 2f * (float)actualTrack; float tmpEnginePower = Mathf.Min(3.9f, 1.9f + (tmpLvlTypeNr * 1 / 6f)), // 1/6 tmpAngularSpeed = Mathf.Min(175f, 100f + (tmpLvlTypeNr * (10 / 6))), // 10/6 tmpSkillMin = Mathf.Max(0.4f, 0.75f - (tmpLvlTypeNr * 0.035f)), //.4f, .75f, .26/6f tmpSkillMax = Mathf.Max(0.05f, 0.35f - (tmpLvlTypeNr * 0.035f)), //.05f, .35f, .5f/6f tmpMass = Mathf.Min(1f, 1f + (tmpLvlTypeNr * (0.25f / 6f))); tmpLvlTypeNr = Mathf.Floor((actualLvl - 1) / 10); if (isOpponentFL) { //EnemyManager4 bananMngr = banan.GetComponent<EnemyManager4>(); bananMngr.setMotorParameters(tmpEnginePower, tmpAngularSpeed, tmpSkillMin, tmpSkillMax, tmpMass); if (actualLvl < 71) { if (firstOpponentFL) { bananMngr.setBananaTypeNr((int)((tmpLvlTypeNr % 7) + 1)); firstOpponentFL = false; } else { bananMngr.setBananaTypeNr(Random.Range(1, (int)((tmpLvlTypeNr % 7) + 2))); } } else { bananMngr.setBananaTypeNr(Random.Range(1, 8)); } } else //is player { tmpEnginePower = Mathf.Min(4.25f, 2f + ((float)(playerData.getEnginePowerLvl() - 1) * 0.075f)); //1.975f ... *0.05f tmpAngularSpeed = Mathf.Min(200f, 100f + ((tmpEnginePower - 2f) * 50)); // (tmpEnginePower-2f) * 50 tmpMass = Mathf.Min(1.125f, 1f + ((float)(playerData.getMassLvl() - 1) * 0.005f)); float tmpMassScaleSize = ((tmpMass - 1f) * 2f) + 1f; banan.transform.localScale = new Vector3(tmpMassScaleSize, tmpMassScaleSize, tmpMassScaleSize); bananMngr.setMotorParameters(tmpEnginePower, tmpAngularSpeed, tmpSkillMin, tmpSkillMax, tmpMass); bananMngr.setBananaTypeNr(0); string tmpNewImageName = playerData.shopStuffGetActive("look"); if (tmpNewImageName != "look01") { bananMngr.checkNewLookImageFromShop(true, tmpNewImageName); } //return true; } float tmpLvlTypeNr10 = actualLvl % 10; if (tmpLvlTypeNr10 == 0) { tmpLvlTypeNr10 = 10; } //Debug.Log("tmpLvlTypeNr10: " + tmpLvlTypeNr10); int tmpHwMnLap = (int)Mathf.Ceil(tmpLvlTypeNr10 / 2f); //Debug.Log("hwMnLap: " + tmpHwMnLap); hwMnLap = tmpHwMnLap; bananMngr.setHwMnLap(tmpHwMnLap); //Debug.Log("tmpEnginePower: " + tmpEnginePower); bananMngr.setDustParticleMaterial(playerData.shopStuffGetActive("smoke")); return(true); }