コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.transform.tag == player_tag)
        {
            string txt  = "";
            int    rand = Random.Range(0, 3);
            switch (rand)
            {
            case 0:
                txt = "Woah!";
                break;

            case 1:
                txt = "Cool!";
                break;

            case 2:
                txt = "Tubular!";
                break;
            }

            score_main.AddPoints(point_value, txt);
            disable_onhit.enabled = false;
            other.gameObject.GetComponentInParent <Boat>().playDing();
        }
    }
コード例 #2
0
ファイル: Boat.cs プロジェクト: Millmoss/boatgame
 void OnCollisionExit(Collision c)
 {
     if (c.gameObject.tag == "Ramp")
     {
         onRamp = false;
         if (boatBody.velocity.magnitude > 10)
         {
             pointsman.AddPoints(100, "RAMPICAL");
         }
     }
     if (c.gameObject.tag == "Ground")
     {
         onGround = true;
     }
 }