コード例 #1
0
    /// <summary>
    /// Tire le projectile en lui appliquant différents paramètres
    /// </summary>
    /// <param name="newParam">Paramètres de tirs appliqués à ce projectile</param>
    /// <param name="startPosition">Position depuis laquelle ce projectile sera tiré</param>
    /// <param name="endPosition">Position visée par ce projectile</param>
    public override void ShootProjectile(ProjectileParameters newParam, Vector3 startPosition, Vector3 endPosition)
    {
        gameObject.SetActive(true);

        projectileParameters = newParam;
        boulderStartPosition = startPosition;
        boulderEndPosition   = endPosition;

        projectileParameters.SetUpParameters();
        projectileBody.velocity         = Vector3.zero;
        projectileSizeParent.localScale = Vector3.one * projectileParameters.GetCurrentProjectileSize;
        lifetimeEnded = false;

        projectileParameters.SetLifeTime(GetLifeTimeWithDistance(Vector3.Distance(startPosition, endPosition)));

        relatedHitbox.SetUp(this);
        relatedHitbox.gameObject.SetActive(false);

        projectileRenderer.gameObject.SetActive(true);

        startedFall             = false;
        projectileFunctionEnded = false;
        persistingPlaced        = false;
        projectileReturned      = false;
        explodedOnContact       = false;

        ResetAllSpecialEffects();
        SetUpAirRotation();
    }
コード例 #2
0
ファイル: Projectile.cs プロジェクト: KeldaWind/FUTFourthRepo
    /// <summary>
    /// Tire le projectile en lui appliquant différents paramètres
    /// </summary>
    /// <param name="newParam">Paramètres de tirs appliqués à ce projectile</param>
    /// <param name="direction">Direction appliquée à ce projectile</param>
    /// <param name="currentShipVelocity">Vélocité actuelle su tireur</param>
    public virtual void ShootProjectile(ProjectileParameters newParam, Vector3 direction, Vector3 currentShipVelocity)
    {
        gameObject.SetActive(true);
        projectileParameters = newParam;
        projectileParameters.SetProjectileDirection(direction, currentShipVelocity);
        projectileParameters.SetUpParameters();
        projectileBody.velocity         = projectileParameters.GetCurrentProjectileVelocity;
        projectileSizeParent.localScale = Vector3.one * projectileParameters.GetCurrentProjectileSize;
        lifetimeEnded = false;

        relatedHitbox.gameObject.SetActive(true);
        relatedHitbox.SetUp(this);

        projectileRenderer.gameObject.SetActive(true);

        projectileFunctionEnded = false;
        projectileReturned      = false;

        ResetAllSpecialEffects();


        if (endLifeTimeHeightCurve == null)
        {
            endLifeTimeHeightCurve = endLifeTimeHeightCurve.SetAsSlowInFastOutDecreasingCurve();
        }
        else if (endLifeTimeHeightCurve.length == 0)
        {
            endLifeTimeHeightCurve = endLifeTimeHeightCurve.SetAsSlowInFastOutDecreasingCurve();
        }

        if (projectileParameters.GetTotalLifeTime < normalFallDuration)
        {
            thisFallDuration = projectileParameters.GetTotalLifeTime;
        }
        else
        {
            thisFallDuration = normalFallDuration;
        }

        startedFall       = false;
        persistingPlaced  = false;
        explodedOnContact = false;

        SetUpAirRotation();
    }