Exemple #1
0
 /// <summary>
 /// Returns the current position of the ship image in the progress bar
 /// </summary>
 /// <returns>Position in the screen</returns>
 private float getProgress()
 {
     //check if it is the last waypoint
     if (survivalLevelMgr.CurrentWaypointIndex < survivalLevelMgr.NumWaypoints)
     {
         //get the correct number of the next waypoint
         int point = (survivalLevelMgr.NumWaypoints - survivalLevelMgr.CurrentWaypointIndex) - 1;
         //calculate the position regarding the distance to the next waypoint
         float interval = survivalLevelMgr.calculateDistanceNextWaypoint() / totalDistance;
         //return the correct position between two waypoints
         return(Mathf.Lerp(finalPosition + positionY * point, finalPosition + positionY * (point + 1), interval));
     }
     else
     {
         return(finalPosition);
     }
 }
Exemple #2
0
    // Use this for initialization
    protected override void Start()
    {
        base.Start();
        survivalLevelMgr = levelMgr as SurvivalLevelManager;
        positionY        = iconSize * 3 / survivalLevelMgr.NumWaypoints;

        totalDistance = survivalLevelMgr.calculateDistanceNextWaypoint();
        finalPosition = Screen.height * 2 / 10;
    }