void OnTriggerEnter(Collider col) { GetComponent <AudioSource>().enabled = true; GetComponent <AudioSource>().clip = HGAudioLoader.Load("get_coin"); GetComponent <AudioSource>().Play(); //transform.parent.gameObject.SetActive(false); transform.gameObject.GetComponent <Renderer>().enabled = false; GameObject.FindWithTag("Character_").GetComponent <HGCharacter>().UpdateScore(); }
} //待完善 void OnCollisionEnter(Collision collision) { //if (collision.gameObject.name==) Charc.UpdateMode(HGBlockType.Mode_End); if (collision.gameObject.name == "Ground") { GetComponent <AudioSource>().clip = HGAudioLoader.Load("fall"); } else { GetComponent <AudioSource>().clip = HGAudioLoader.Load("hit"); } GetComponent <AudioSource>().Play(); StopCoroutine("AutoAddSpeed"); GetComponent <Rigidbody>().velocity = new Vector3(0f, 0f); GetComponent <ConstantForce>().force = new Vector3(0f, DropForce); }
void HGc_mode_flypee() { transform.Rotate(Vector3.back * MoveSpeedInitialize / 2f, Space.World); if (Input.GetButtonDown("Jump")) { GetComponent <AudioSource>().clip = HGAudioLoader.Load("jump"); GetComponent <AudioSource>().Play(); Vector3 VecTemp = new Vector3(0f, (GetComponent <Rigidbody>().velocity.y < JumpSpeedLimit ? JumpForce : 0f), 0f); GetComponent <Rigidbody>().AddForce(VecTemp); } if (Input.GetButtonDown("Pause")) { print("Paused\n"); GetComponent <ConstantForce>().force = new Vector3(0f, 0f, 0f); GetComponent <Rigidbody>().velocity = new Vector3(0f, 0f, 0f); Charc.UpdateMode(HGBlockType.Mode_Pause); } }