public void WaypointHitByPlayer(Waypoint waypoint) { if(waypoint.Next == null) { GameManagerInstance.Instance.Points += (int)Mathf.Ceil(TimeLeft) * 10; if(!string.IsNullOrEmpty(NextLevel)) { if(GameManagerInstance.Instance.IsDebug) { Debug.Log ("You are moving onto the next level"); } else { Application.LoadLevel (NextLevel); } } else { GameManagerInstance.Instance.EndGame (true); } } TimeLeft += waypoint.TimeModifier; }
// Use this for initialization public void Start() { _currentWaypoint = FirstWaypoint; var waypoint = _currentWaypoint.Next; while(waypoint != null) { waypoint.gameObject.SetActive(false); waypoint = waypoint.Next; } _player = (Player)FindObjectOfType<Player>(); _levelManager = (LevelManager)FindObjectOfType<LevelManager>(); }
public void PlayerHitWaypoint(Waypoint waypoint) { _levelManager.WaypointHitByPlayer(waypoint); _player.MinimumVelocity = waypoint.MinimumVelocity; waypoint.Deactivate(); _currentWaypoint = waypoint.Next; if(_currentWaypoint == null) { return; } _currentWaypoint.gameObject.SetActive(true); }