예제 #1
0
    /// <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;
    }
예제 #2
0
    /// <summary>
    /// Initialize this state.
    /// </summary>
    public void Initialize()
    {
        if (cameraInGameState == null || shootPreview == null)
        {
            Transform cameraTransform = GameManager.Instance.MainCamera, _player = GameManager.Instance.gameMode.Player;

            if (shootPreview == null)
            {
                shootPreview = new ShootPreview(cameraTransform, _player);
            }
            if (cameraInGameState == null)
            {
                cameraInGameState = new CameraRotateAroundBehaviour(cameraTransform, _player, new Vector3(-5f, 4f, 5f), 2.5f);
            }
        }
    }
예제 #3
0
    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>();
    }