//methods public void GenerateWind() { GameManager gameManager = FindObjectOfType <GameManager>(); if (gameManager == null) { Debug.LogError("Wind generator cannot acces Game Manager component!"); } HotSeatCompetition competition = gameManager.ActualCompetition as HotSeatCompetition; if (competition != null && competition.HasWind) { RandomAngle(competition.WindAngle); RandomStrenght(competition.WindStrenght); } else { RandomAngle(); RandomStrenght(); } VectorPoint(); wind = new Vector2(x, y); windGenerated = true; return; }
void Start() { _rb = GetComponent <Rigidbody2D>(); _rb.gravityScale = 0; _wind = Wind.GetComponent <WindGenerator>(); _bestAirResistance = Quaternion.Euler(new Vector3(0, 0, -21)); _highScoreLine = HighScore.GetComponent <HighScoreLine>(); _lastPrefab = 0; State = playerState.Wait; if (_competitionManager == null) { _competitionManager = FindObjectOfType <CompetitionManager>(); if (_competitionManager == null) { Debug.LogError("There is no _competition manager instatieted!"); } _competition = _competitionManager as HotSeatCompetition; if (_competition != null) { _competition.ShowName(); } } }