private void Update() { switch (m_PlayerManager.GetPlayerGun().GetPlayerSupporterType()) { case PlayerSupporterType.Missile: break; case PlayerSupporterType.Guider: { GunVulcan gunVulcan = m_PlayerManager.GetPlayerGun() as GunVulcan; Dictionary <int, PlayerSupporterCore> supporterCores = gunVulcan.GetSupporters(); for (int i = 0; i < supporterCores.Count; i++) { if (supporterCores[i] != null) { if (supporterCores[i].GetLastPosition() == m_SupporterPositionTransforms[i].position) { return; } supporterCores[i].GetTween().ChangeEndValue(m_SupporterPositionTransforms[i].position, true).Restart(); supporterCores[i].SetLastPosition(supporterCores[i].transform.position); } } break; } case PlayerSupporterType.Vulcan: break; } }
public void SpawnPlayerSupporter(PlayerSupporterType playerSupporterType) { switch (playerSupporterType) { case PlayerSupporterType.Missile: break; case PlayerSupporterType.Guider: { GunVulcan playerGun = m_PlayerManager.GetPlayerGun() as GunVulcan; if (playerGun.GetPlayerSupporterCount() >= playerGun.GetMaxPlayerSupporterCount()) { //HP 만땅같은거 넣어줘도 될뜻 아무 효과도 없으니.. return; } PlayerSupporterController controller = m_PlayerManager.GetPlayer().GetComponent <PlayerSupporterController>(); Transform[] playerSupporterStandardTransforms = controller.m_SupporterPositionTransforms; Vector3 spawnPosition; //float spawnRotation = playerGun.GetPlayerSupporterCount() == 0 ? -90.0f : 90.0f; float endRotationBy = playerGun.GetPlayerSupporterCount() == 0 ? -270.0f : 270.0f; if (m_PlayerManager.GetPlayer().transform.position.x < m_StageManager.GetScreenSize().Width / 2) { spawnPosition = m_EnemyManager.GetEnemySpawnPoints(Direction.Left)[Random.Range(0, 5)].position; } else { spawnPosition = m_EnemyManager.GetEnemySpawnPoints(Direction.Right)[Random.Range(0, 5)].position; } PlayerSupporterCore supporterCore = Instantiate(m_Guider, spawnPosition, Quaternion.Euler(0.0f, 0.0f, /*spawnRotation*/ 0.0f)).GetComponent <PlayerSupporterCore>(); supporterCore.SetHp(30); //DOTween.Sequence().Append(supporterCore.gameObject.transform.DOBlendableLocalRotateBy(new Vector3(0.0f, 0.0f, endRotationBy), 2.0f)); playerGun.AddSupporter(supporterCore); break; } case PlayerSupporterType.Vulcan: break; } }
protected override void OnDestroy() { base.OnDestroy(); //플레이어가 총알에 맞아 삭제되는 경우 먼저 서포터를 삭제 해준 후 본체를 삭제하자 switch (m_PlayerManager.GetPlayerGun().GetPlayerSupporterType()) { case PlayerSupporterType.Missile: break; case PlayerSupporterType.Guider: { GunVulcan gunVulcan = m_PlayerManager.GetPlayerGun() as GunVulcan; gunVulcan.RemoveSupporter(this); break; } case PlayerSupporterType.Vulcan: break; } }
private void FireVulcanBullet() { GunVulcan vulcanGun = m_PlayerManager.GetPlayerGun() as GunVulcan; GunCoreCharging playerGunCoreCharging = vulcanGun.GetCore <GunCoreCharging>(); if (vulcanGun is null) { throw new NullReferenceException("vulcanGun 오브젝트가 null입니다."); } //if (vulcanGun.GetPowerLevel() == 1) //{ // if (playerGunCoreCharging.IsCharging() == false && playerGunCoreCharging.IsChargingFiring() == false) // Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation); // else // { // float chargedPercent = playerGunCoreCharging.GetChargingTime() / playerGunCoreCharging.GetMaxCharingTime() * 100; // playerGunCoreCharging.SetChargingTime(0.0f); // playerGunCoreCharging.SetIsChargingFull(false); // playerGunCoreCharging.SetIsCharging(false); // playerGunCoreCharging.SetIsChargingFiring(true); //밑에 두면안된다. bulletCount가 0일 경우에 바로 m_IsChargingFiring값이 false로 되버리기 때문에 그 이후 true로 바껴버리면 담에 발사가 안됨 // StartCoroutine(VulcanChargingFire(playerGunCoreCharging, vulcanGun.GetPowerLevel(), chargedPercent)); // } //} if (playerGunCoreCharging.IsCharging() == false && playerGunCoreCharging.IsChargingFiring() == false) { if (vulcanGun.GetPowerLevel() == 1) { Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation); } else if (vulcanGun.GetPowerLevel() == 2) { Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation); } else if (vulcanGun.GetPowerLevel() == 3) { Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation); } else if (vulcanGun.GetPowerLevel() == 4) { Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[3].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[4].position, m_FireTransforms[0].rotation); } else if (vulcanGun.GetPowerLevel() == 5) { Instantiate(m_VulcanBullet, m_FireTransforms[0].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[1].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[2].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[3].position, m_FireTransforms[0].rotation); Instantiate(m_VulcanBullet, m_FireTransforms[4].position, m_FireTransforms[0].rotation); } } else { float chargedPercent = playerGunCoreCharging.GetChargingTime() / playerGunCoreCharging.GetMaxCharingTime() * 100; playerGunCoreCharging.SetChargingTime(0.0f); playerGunCoreCharging.SetIsChargingFull(false); playerGunCoreCharging.SetIsCharging(false); playerGunCoreCharging.SetIsChargingFiring(true); //밑에 두면안된다. bulletCount가 0일 경우에 바로 m_IsChargingFiring값이 false로 되버리기 때문에 그 이후 true로 바껴버리면 담에 발사가 안됨 StartCoroutine(VulcanChargingFire(playerGunCoreCharging, vulcanGun.GetPowerLevel(), chargedPercent)); } vulcanGun.SetCurrentBulletFiringTime(0.0f); vulcanGun.SetFireEnabled(false); }