예제 #1
0
    public void playerShoot()
    {
        if (fireTimer >= fireRate && !isPaused)
        {
            createProjectile.tirer(projectile);
            fireTimer = 0;

            //Changer l'image du curseur
            if (levelManager.GetComponent <UIManager>())
            {
                Texture2D cursorDisabled = levelManager.GetComponent <UIManager>().cursorImageDisable;
                Cursor.SetCursor(cursorDisabled, new Vector2(cursorDisabled.width / 2, cursorDisabled.height / 2), CursorMode.Auto);
            }
        }
    }
예제 #2
0
    /// <summary>
    ///     Tirer sur la cible. La méthode vérifier si le cible est en vue avant de tirer.
    /// </summary>
    /// <returns>
    ///     True si le tank a tiré, false sinon.
    /// </returns>
    protected bool shootTarget()
    {
        bool hasShoot = false;

        if (canShoot && isTargetInSight())
        {
            Debug.Log("Target is in sight");
            shoot.tirer(projectile);
            hasShoot = true;
        }
        else
        {
            Debug.Log("Target is not in sight");
        }

        return(hasShoot);
    }