Example #1
0
 /// <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();
         }
     }
 }
Example #2
0
    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;
    }
Example #3
0
 private void OnCollisionStay2D(Collision2D collision)
 {
     if (collision.collider.CompareTag("Player"))
     {
         ScoreTracker.AddScore(scoreOnPickup);
         GameAudioController.playRubyPickup();
         Destroy(gameObject);
     }
 }
Example #4
0
 void CheckDestroy()
 {
     if (currentHealth <= 0)
     {
         score.numTrackers += 1;
         Debug.Log(score.numTrackers);
         score.AddScore(10f);
         Destroy(gameObject);
     }
 }
Example #5
0
    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);
        }
    }
Example #6
0
    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);
        }
    }
Example #7
0
 //Adds points to the designated player when called.
 public void AddPoints(bool whatPlayer)
 {
     scoreTracker.AddScore(points, whatPlayer);
 }