/// <summary> /// Commence la prévisualisation de préparation d'une salve /// </summary> /// <param name="salvo">Salve à prévisualiser</param> public void ShowPreparePreview(Salvo salvo) { if (!BeingUsed) { lockDirectionAfterStartShoot = false; } previewingSalvo = salvo; if (spawnedPreviews == null) { spawnedPreviews = new List <ShootPreview>(); } Projectile previewingProjectile = GameManager.gameManager.PoolManager.GetProjectile(salvo.GetProjectileType, PoolInteractionType.PeekPrefab); bool isBoulder = previewingProjectile.IsBoulder; List <Vector3> allShootDirections = isBoulder ? GetAllShootPositions(salvo) : GetAllShootDirections(salvo); foreach (Vector3 vector in allShootDirections) { /*Instantiate(previewingProjectile.GetShootPreviewPrefab)*/ ShootPreview preview = GameManager.gameManager.PoolManager.GetPreview(previewingProjectile.GetShootPreviewType, PoolInteractionType.GetFromPool) as ShootPreview; preview.ShowPreparePreview(salvo, currentShootParameters.GetProjectileTag); spawnedPreviews.Add(preview); } showPreview = true; }
public void ContinueLaunchedPreview(Salvo salvo) { if (spawnedPreviews == null) { return; } Projectile previewingProjectile = GameManager.gameManager.PoolManager.GetProjectile(salvo.GetProjectileType, PoolInteractionType.PeekPrefab); List <float> allDistances = GetAllDistances(previewingSalvo); bool isBoulder = previewingProjectile.IsBoulder; List <Vector3> allShootDirections = isBoulder ? GetAllShootPositions(salvo) : GetAllShootDirections(salvo); foreach (Vector3 vector in allShootDirections) { //ShootPreview preview = Instantiate(previewingProjectile.GetShootPreviewPrefab); ShootPreview preview = GameManager.gameManager.PoolManager.GetPreview(previewingProjectile.GetShootPreviewType, PoolInteractionType.GetFromPool) as ShootPreview; preview.ShowPreparePreview(salvo, currentShootParameters.GetProjectileTag); spawnedPreviews.Add(preview); } if (spawnedPreviews == null) { return; } for (int i = 0; i < spawnedPreviews.Count; i++) { Preview preview = spawnedPreviews[i]; float parameter = 0; if (previewingProjectile as ProjectileBoulder != null) { parameter = (previewingProjectile as ProjectileBoulder).GetLifeTimeWithDistance(allDistances[i]); } preview.StartLaunchedPreview(transform.position, shootedPositions[i], parameter); } spawnedPreviews = new List <ShootPreview>(); }