- Home /
 
 
               Question by 
               Jokeerr · Jul 12, 2016 at 05:38 PM · 
                error messagedialogue  
              
 
              Dialogue related. Can't get this code to work. Any suggestions ?
Hello, I am using the latest version of unity 5 and mine is a 2d game. For the pause dialogue and other dialogues I got everything to work except for one code to fix the problem. And yes I am following a tutorial. Thank you. private bool isGrounded; private float radius = 0.7f; private float force = 325; public Transform coinsParent; public Transform groundPoint; public LayerMask ground; public AudioSource audioSource; public AudioClip Jump; public AudioClip Coin; public AudioClip Win; public Animator animator; public int coins; public Game gameComponent;//Game reference; public TextMesh score;
     bool shownDialogueType;
     bool jumped;
     float jumpTime = 0;
     float jumpDelay = 0.5f;
 
     void Start () 
     {
         animator = GetComponent<Animator> ();
     }
     
     // Update is called once per frame
     void Update()
     {
         isGrounded = Physics2D.OverlapCircle(groundPoint.position, radius, ground);
         if (isGrounded)
         {
             if (Input.GetMouseButtonDown(0))
             {
                 gameObject.GetComponent<Rigidbody2D>().AddForce(Vector2.up * force);
                 audioSource.clip = Jump;
                 audioSource.Play();
 
                 jumpTime=jumpDelay;
                 jumped=true;
                 animator.SetTrigger("jumped");
             }
         }
 
         jumpTime -= Time.deltaTime;
 
         if (jumpTime <=0 && isGrounded && jumped)
         {
              animator.SetTrigger("landed");
              jumped=false;
         }
 
     }
     void OnTriggerEnter2D(Collider2D collider2d)
     {
         if (collider2d.tag == "Coin") ;
         {
             coins++;
             score.text = coins + "";
             Destroy(collider2d.gameObject);
             audioSource.clip = Coin;
             audioSource.Play();
         }
 
         if (collider2d.tag == "DeadZone")
         {
             
             Game.shownDialogueType = Game.DialogType.LOSE;
             gameComponent.OnGameLose(Game.LoseReason.WRONG_CHOICE);
             //Application.LoadLevel("level1");
         }
 
         else if (collider2d.tag == "Finish")
         {
             audioSource.clip = Win;
             audioSource.Play();
         }
         
 
 
              
               Comment
              
 
               
              Your answer