/// <summary> /// Must be called by object being destroyed (e.g. GlassBall) /// to account score correctly /// </summary> /// <param name="y_pos">The position of the ball</param> public void ShredDetection(float y_pos) { if (PhotonNetwork.connected) { if (y_pos > 0) { if (PhotonNetwork.isMasterClient) { other_team_st.AddScore(); photon_view.RPC("SendScoreUpdateOverNetwork", PhotonTargets.OthersBuffered, 0, other_team_st.Score); } } else { if (PhotonNetwork.isMasterClient) { this_team_st.AddScore(); photon_view.RPC("SendScoreUpdateOverNetwork", PhotonTargets.OthersBuffered, 1, this_team_st.Score); } } } else { if (y_pos > 0) { this_team_st.AddScore(); } else { other_team_st.AddScore(); } } }
public void Death() { AudioSource.PlayClipAtPoint(explosion, new Vector3(0, 0, 0)); if (haveDrop) { DropPowerUp(); } ScoreTracker reference = FindObjectOfType <Canvas>().GetComponentInChildren <ScoreTracker>(); switch (UserType) { case Type.Enemy1: reference.AddScore(100); break; case Type.Enemy2: reference.AddScore(25); break; case Type.Enemy3: reference.AddScore(500); break; case Type.Player: FindObjectOfType <Canvas>().transform.Find("EndGame").gameObject.SetActive(true); break; } this.gameObject.SetActive(false); this.dead = true; }
private void OnCollisionStay2D(Collision2D collision) { if (collision.collider.CompareTag("Player")) { ScoreTracker.AddScore(scoreOnPickup); GameAudioController.playRubyPickup(); Destroy(gameObject); } }
void CheckDestroy() { if (currentHealth <= 0) { score.numTrackers += 1; Debug.Log(score.numTrackers); score.AddScore(10f); Destroy(gameObject); } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "BeachBall") { scoreTracker.AddScore(); Debug.Log(scoreTracker.score); SpawnCheck(); //add force to beach ball other.gameObject.GetComponent <Rigidbody2D>().AddForce(transform.up * forceApplied); GetComponent <AudioSource>().PlayOneShot(hitSound, 0.7f); } }
void CheckDestroy() { var miny = Camera.main.transform.position.y - Camera.main.orthographicSize - 1; if (currentHealth <= 0) { score.numBasic += 1; score.AddScore(20f); Destroy(gameObject); } else if (transform.position.y < miny) { Destroy(gameObject); } }
//Adds points to the designated player when called. public void AddPoints(bool whatPlayer) { scoreTracker.AddScore(points, whatPlayer); }