コード例 #1
0
    //void FixedUpdate()
    //{

    //}
    void GameOver()
    {
        isGameOver = true;
        myChallenge.GameOver();
        SoundMScript.PlaySound("death");
        animator.SetBool("isDeath", true);
    }
コード例 #2
0
 void Die()
 {
     //Instantiate(deathEffect, transform.position, Quaternion.identity);
     //Destroy(gameObject);
     anim.SetBool("isDie", true);
     anim.SetBool("isHurt", false);
     //sound
     SoundMScript.PlaySound("death");
 }
コード例 #3
0
 public void Attack()
 {
     //if (Input.GetKeyDown(KeyCode.B))
     //{
     //Cara memanggil animasi dengan
     //parameter yang bertipe Trigger
     anim.SetTrigger("isAttack");
     //suara tembakan
     SoundMScript.PlaySound("fire");
     Shoot();
     //}
 }
コード例 #4
0
 void CharacterJump()
 {
     verticalMove = joystick.Vertical;
     //if (isGrounded == true && Input.GetKeyDown(KeyCode.Space))
     if (isGrounded == true && verticalMove >= .5f)
     {
         //Cara memanggil animasi dengan
         //parameter yang bertipe Trigger
         anim.SetTrigger("isJump");
         //sound jump
         SoundMScript.PlaySound("jump");
         rigidBody.velocity = new Vector2(rigidBody.velocity.x, jumpForce);
     }
 }
コード例 #5
0
 void Update()
 {
     //if (Input.GetKeyDown(KeyCode.Space) && isGround && !isGameOver)
     if (Input.touchCount > 0 && isGround && !isGameOver)
     {
         myRigidbody.AddForce(Vector3.up * (jumpPower * myRigidbody.mass * myRigidbody.gravityScale * 20.0f));
         SoundMScript.PlaySound("jump");
         animator.SetBool("isRun", false);
         animator.SetBool("isJump", true);
     }
     //Hit
     if (transform.position.x < posX)
     {
         GameOver();
     }
 }