public Vector3 randPosWithinMinMaxRange(Vector3 startFrom, float minDist, float maxDist, FishMoverBasic fmb = null) { // this approaches bias motion away from edges where boundaries affect motion Vector3 randGoal = ( fmb == null ? randPos() : randPosBandBias(fmb.depthBiasOdds, fmb.shallowPerc, fmb.deepPerc, true) ); // this next bit helps reduce bunching near edges if(Random.Range(0.0f,1.0f) < 0.6f) { // X% of the time, average halfway to center float centerX = (left + right) * 0.5f; randGoal.x = (randGoal.x + centerX) * 0.5f; // weight toward middle float diffX = randGoal.x - centerX; randGoal.x -= diffX * 1.5f; // encourage crossing over } Vector3 normToward = (randGoal - startFrom).normalized; Vector3 inRange = startFrom+normToward*Random.Range(minDist,maxDist); return constrainTrunc(inRange); }
public void NewMessage(string thisText, int pointValue, FishMoverBasic fmbKilled, HarpoonDrag harpoon) { ComboText.text = thisText + " +" + pointValue + "pt"; clearTextTime = Time.time + 3.0f; ScoreManager.instance.ScoreAddMegaPop(fmbKilled, harpoon, pointValue); }
public void ScoreAddMegaPop(FishMoverBasic fmbScored, HarpoonDrag thrownSpear, int scoreAmt) { ScorePop(fmbScored.gameObject,thrownSpear,scoreAmt); /*Vector3 textPos = fmbScored.transform.position; int scoreAdded = fmbScored.scoreValue; totalScore += scoreAdded; totalScoreText.text = ""+totalScore+" "; if(thrownSpear == lastThrownSpear) { lastThrowScore += scoreAdded; lastThrowScoreText.text = ""+lastThrowScore; if(lastThrowScore >= extraHarpoonThreshold && extraHarpoonEarnedSinceLastThrow == false) { spearsLeft++; harpoonAwardMessage.text="You earned an extra harpoon!"; extraHarpoonEarnedSinceLastThrow = true; UpdateSpearCount(); } } GameObject scoreGO = GameObject.Instantiate(scorePopPrefab); Text textScript = scoreGO.GetComponent<Text>(); textScript.text = "+" + scoreAdded; textScript.transform.localScale *= 2.0f; scoreGO.transform.SetParent(uiCanvas.transform); textPos.z = Camera.main.transform.position.z + 0.35f; scoreGO.transform.position = textPos; scoreGO.transform.localScale = Vector3.one * 0.8f;*/ }
public void SetAllFishAI(FishMoverBasic.FishMove toMode) { defaultAI = toMode; for(int iii = 0; iii < fishList.Count; iii++) { fishList[iii].GetComponent<FishMoverBasic>().setAIMode(toMode); } aiFishText.text = ""+toMode; }