public void SpawnRandomProp(List <RoadObstacle> propList, HighScore highScore, HealthPointsSystem healthPointsSystem, FloatingScoreSpawner floatingScoreSpawner, float chanceToSpawnProp) { if (Random.value <= chanceToSpawnProp) { SpawnRandomProp(propList, highScore, healthPointsSystem, floatingScoreSpawner); } }
public void SpawnRandomProp(List <RoadObstacle> propList, HighScore highScore, HealthPointsSystem healthPointsSystem, FloatingScoreSpawner floatingScoreSpawner) { var propToSpawn = GetRandomProp(propList); var randomPosition = GetRandomPosition(propToSpawn); var prop = Instantiate(propToSpawn, randomPosition, propToSpawn.transform.rotation); prop.highScore = highScore; prop.healthPointsSystem = healthPointsSystem; prop.floatingScoreSpawner = floatingScoreSpawner; Destroy(prop.gameObject, 10f); }
protected virtual void Awake() { base.Awake(); levelSystem = new LevelSystem(); statsSystem = new StatsSystem(playerStatsDatum, levelSystem.GetLevel()); healthPointsSystem = new HealthPointsSystem(statsSystem.GetTotalMaxHealthPoints()); command = new NullCommand(this); #region State state = basicState = new BasicState(this); dieState = new DieState(this, 5f); state.Begin(); #endregion RuntimeAnimatorController runtimeAnimatorController = transform.Find("model").GetComponent <Animator>().runtimeAnimatorController; AnimationClip[] animationClips = runtimeAnimatorController.animationClips; for (int i = 0; i < animationClips.Length; i++) { clipLengths.Add(animationClips[i].name, animationClips[i].length); print(animationClips[i].name + ": " + animationClips[i].length); } }
protected void Awake() { statsSystem = new StatsSystem(statsDatum); healthPointsSystem = new HealthPointsSystem(statsSystem.GetTotalMaxHealthPoints()); }