示例#1
0
    private void OnCollisionEnter(Collision coll)
    {
        if (coll.collider.tag == "Player" || coll.collider.tag == "Enemy")
        {
            if (skilltype == SkillType.Push)
            {
                Destroy(this.gameObject);
                Vector3 yyyy = new Vector3(0, 0.5f, 0);
                Instantiate(hartBroken1, coll.transform.position + yyyy, coll.transform.rotation);

                SoundMgr.playSound(SkillSound, musicPlayer);

                //맞은 상대의 위치를 뒤로 밀어준다. - 1번째 공격의 효과
                coll.gameObject.GetComponent <Rigidbody>().AddRelativeForce(Vector3.forward * 400f);
            }
            if (skilltype == SkillType.PowerPush)
            {
                Destroy(this.gameObject);
                Vector3 yyyy = new Vector3(0, 0.5f, 0);
                Instantiate(hartBroken2, coll.transform.position + yyyy, coll.transform.rotation);

                SoundMgr.playSound(SkillSound, musicPlayer);

                //맞은 상대의 위치를 좌로 밀어준다. - 2번째 공격의 효과
                coll.gameObject.GetComponent <Rigidbody>().AddRelativeForce(Vector3.left * 500f);
            }
        }
    }
示例#2
0
 void Fire2()
 {
     Instantiate(Skill2, firePos.position, firePos.rotation);
     SoundMgr.playSound(SkillSound, musicPlayer); // 스킬 사운드 실행
 }