Пример #1
0
 private void ActivateBGDeactivateOthers(string theme)
 {
     if (theme.Equals("neutral"))
     {
         SetActivationOfGoInArray(ref backGroundNeutral, true);
         SetActivationOfGoInArray(ref backGroundSnow, false);
         SetActivationOfGoInArray(ref backGroundForest, false);
         SetActivationOfGoInArray(ref backGroundDesert, false);
     }
     else if (theme.Equals("snow"))
     {
         SetActivationOfGoInArray(ref backGroundNeutral, false);
         SetActivationOfGoInArray(ref backGroundSnow, true);
         SetActivationOfGoInArray(ref backGroundForest, false);
         SetActivationOfGoInArray(ref backGroundDesert, false);
     }
     else if (theme.Equals("forest"))
     {
         SetActivationOfGoInArray(ref backGroundNeutral, false);
         SetActivationOfGoInArray(ref backGroundSnow, false);
         SetActivationOfGoInArray(ref backGroundForest, true);
         SetActivationOfGoInArray(ref backGroundDesert, false);
     }
     else if (theme.Equals("desert"))
     {
         SetActivationOfGoInArray(ref backGroundNeutral, false);
         SetActivationOfGoInArray(ref backGroundSnow, false);
         SetActivationOfGoInArray(ref backGroundForest, false);
         SetActivationOfGoInArray(ref backGroundDesert, true);
     }
     BackgroundSpawner.setBackgroundTheme(theme);
 }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        /*for(int i = 0; i < Backgrounds.Length; i++)
         * {
         *  Backgrounds = GameObject.FindGameObjectsWithTag("BackgroundAsset");
         * }*/

        spawner = GameObject.Find("Background Colour").GetComponent <BackgroundSpawner>();

        foreach (GameObject bg in GameObject.FindGameObjectsWithTag("BackgroundAsset"))
        {
            spawner.Backgrounds.Add(bg);
        }


        PreviousCamPos = cam.position;

        ParrallaxScales = new float[spawner.Backgrounds.Count];
        for (int i = 0; i < spawner.Backgrounds.Count; i++)
        {
            ParrallaxScales[i] = spawner.Backgrounds[i].transform.position.z * -1;
        }

        //grabs background and attachs it to the parralax
    }
Пример #3
0
 // Use this for initialization
 void Awake()
 {
     stackRef = GetComponent<difficultyStack> ();
     if(!GetComponent<trackManager>())
     {
         managerRef = GameObject.Find ("GameManager");
         if(GetComponent<trackManager>())
         {
             if(GetComponent<trackManager>().enabled)
                 inEditor = true;
         }
         if(playerRef==null)
             playerRef = GameObject.Find ("Skater");
         nextSegmentPosition = GameObject.Find ("InitPart").GetComponent<trackPartData> ().endPoint.transform.position;
         segmentPoolRef = managerRef.GetComponent<trackSegmentPool> ();
         partPoolRef = managerRef.GetComponent<trackPartPool> ();
         pickUpPoolRef = managerRef.GetComponent<PickUpPool>();
         backgroundRef = GetComponent<BackgroundSpawner>();
         segmentPoolRef.loadSegments ();
     }
 }