public bool spearOutOfBounds(Vector3 someVect, HarpoonDrag spearRef) { return ( (someVect.x > right+edgeMargin*0.1 && spearRef.motion.x > 0.0f) || (someVect.x < left-edgeMargin*0.1 && spearRef.motion.x < 0.0f) || someVect.y > spearTop+edgeMargin*0.1 || someVect.y < bottom-edgeMargin*0.1); }
void Start() { if(reportKillsTo == null) { reportKillsTo = GameObject.Find("LevelFishSpawner"); } harpoonRefIfIAmOne = GetComponent<HarpoonDrag>(); }
public void ScorePop(GameObject enemyScored, HarpoonDrag thrownSpear, int scoreAmt = -1) { FishMoverBasic fmbScript = enemyScored.GetComponent<FishMoverBasic>(); Vector3 textPos; HarpoonablePassingMonster hpmScript = enemyScored.GetComponent<HarpoonablePassingMonster>(); if(fmbScript != null) { textPos = fmbScript.diedPos; } else if(hpmScript != null) { textPos = hpmScript.transform.position; } else { textPos = enemyScored.transform.position; } int scoreAdded; if(fmbScript && fmbScript.stolenByShark) { scoreAdded = 0; } else { scoreAdded = (scoreAmt == -1 ? (fmbScript ? fmbScript.scoreValue : hpmScript.scoreValue ) : scoreAmt); } nextScore += scoreAdded; // nextScoreText.text = "+"+nextScore; //// since only allowing one harpoon at a time can use Last Score as same val if(thrownSpear == lastThrownSpear) { lastThrowScore += scoreAdded; lastThrowScoreText.text = "" + lastThrowScore; if(lastThrowScore >= extraHarpoonThreshold && extraHarpoonEarnedSinceLastThrow == false) { FMODUnity.RuntimeManager.PlayOneShot("event:/new_harpoons"); if(MenuStateMachine.instance.tutStep == MenuStateMachine.TUTORIAL_PHASE.ExtraSpear) { MenuStateMachine.instance.NextStep(); } if(spearsLeft == 0) { MenuStateMachine.instance.DidAchivement(MenuStateMachine.ACHIEVEMENT_ENUM.savingThrow,100.0f); } /* spearsLeft++; if(MenuStateMachine.instance.notInTut()) { harpoonAwardMessage.text = "You earned an extra harpoon!"; } */ extraHarpoonEarnedSinceLastThrow = true; UpdateSpearCount(); } } GameObject scoreGO = GameObject.Instantiate(scorePopPrefab); Text textScript = scoreGO.GetComponent<Text>(); if(fmbScript && fmbScript.stolenByShark) { textScript.text = "STOLEN"; } else { textScript.text = (scoreAdded > 0 ? "+" : "") + scoreAdded; } scoreGO.transform.SetParent(uiCanvas.transform); scoreGO.transform.localScale = Vector3.one * 0.8f; textPos.z = Camera.main.transform.position.z + 0.35f; if(scoreAmt != -1) { scoreGO.transform.localScale *= 0.7f; // textPos.y += 1.5f; } scoreGO.transform.position = textPos; }
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 bool NewSpearThrown(HarpoonDrag newOne) { if(spearsLeft > 0) { FishTime.fishPacing = (FishTime.useBulletTime ? 0.05f : 1.0f); spearsOut++; lastThrownSpear = newOne; lastThrowScoreText.text = "" + lastThrowScore; nextScoreText.text = ""; lastThrowScore = 0; extraHarpoonEarnedSinceLastThrow = false; /* if(MenuStateMachine.instance.notInTut()) { spearsLeft--; } */ ClearSpearText(); UpdateSpearCount(); return true; } return false; }
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); }