DragonGameManager gm; // reference to game manager // initialize void Start() { ScoreUpText = Resources.Load("1upText") as GameObject; OneUpIcon = Resources.Load("1upIcon") as GameObject; targetPos = GenerateTargetPosition(); GetComponent <Rigidbody>().isKinematic = true; // set to kinematic to avoid collisions between enemies gm = FindObjectOfType <DragonGameManager>(); // find reference }
Vector3[] enemyWeights = new Vector3[5]; // probability of spawning different enemies for each stage of game // Use this for initialization void Awake() { chickenEnemy = Resources.Load("FlyingChicken") as GameObject; condorEnemy = Resources.Load("FlyingCondor") as GameObject; dragonEnemy = Resources.Load("FlyingDragon") as GameObject; // get game manager for checkpoint value gm = FindObjectOfType <DragonGameManager>(); // initialize enemy weights enemyWeights[0] = new Vector3(1.0f, 0.0f, 0.0f); // at higher checkpoints and scores, P(condor) and P(dragon) should increase enemyWeights[1] = new Vector3(1.0f, 0.0f, 0.0f); enemyWeights[2] = new Vector3(0.3f, 0.7f, 0.0f); enemyWeights[3] = new Vector3(0.1f, 0.2f, 0.7f); enemyWeights[4] = new Vector3(0.1f, 0.2f, 0.7f); checkPointScores = gm.GetCheckPointScores(); // get trigger points from game manager scoreRange = checkPointScores[checkPointScores.Length - 1]; // score range is last item in trigger points }