private void LaunchCog() { GameObject cogProjectileObject = Instantiate(projectilePrefab, rigidbody2d.position + Vector2.up * 0.5f, Quaternion.identity); CogBullet cogProjectile = cogProjectileObject.GetComponent <CogBullet>(); if (cogProjectile != null) { cogProjectile.Launch(lookDirection, 300); animator.SetTrigger("Launch"); } }
/// <summary> /// 发射齿轮飞镖 /// </summary> private void Launch() { if (!GameManager.Instance.m_bIsAcceptTask) { return; } GameObject goCogBullet = Instantiate(m_goCogBullet, transform.position + Vector3.up * 0.5f + (Vector3)m_LookDirction * 0.5f, Quaternion.identity); CogBullet cogBullet = goCogBullet.GetComponent <CogBullet>(); cogBullet.Launch(m_LookDirction, m_fAttackForce); // 播放攻击动画 m_anim.SetTrigger("Launch"); // 播放攻击音效 AudioSource.PlayClipAtPoint(m_acAttack, transform.position); }