Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     settingsScript = GameObject.Find("SettingsHolder").GetComponent <SettingsScript>();
 }
Beispiel #2
0
 void Start()
 {
     settingsObj = GameObject.FindGameObjectWithTag("Settings") as GameObject;
     settingsScript = settingsObj.GetComponent ("SettingsScript") as SettingsScript;
     if (settingsScript.GetIndex () == 0) settingsScript.SetSelectedCharacter (characterSelection, characterArray [characterSelection]);
 }
Beispiel #3
0
    void Start()
    {
        settingsObj = GameObject.FindGameObjectWithTag ("Settings");
        if (settingsObj != null) settingsScript = settingsObj.GetComponent<SettingsScript> () as SettingsScript;

        player = Instantiate (settingsScript.GetPlayer(),new Vector3(-16,0,-9),Quaternion.identity) as GameObject;
        if (player != null) playerScript = player.GetComponent<PlayerScript> () as PlayerScript;

        scrollingBackgroundScript = this.GetComponent<ScrollingBackgroundScript> () as ScrollingBackgroundScript;

        if (scrollingBackgroundScript != null) scrollingBackgroundScript.Init ();
        else Debug.LogError ("No scrolling background");

        ChangeState(GameState.preGame);
    }
Beispiel #4
0
 void Awake()
 {
     if (_instance == null) {
         audioSource = gameObject.GetComponents<AudioSource>();
         audioSource[0].clip = MenuMusic;
         audioSource[0].Play();
         _instance = this;
         DontDestroyOnLoad (this);
     } else { if(this != _instance) Destroy(this.gameObject); }
 }
Beispiel #5
0
    public SettingsData(SettingsScript settings)
    {

        this.soundEffectVol = settings.soundEffectVol;
        this.soundEffectMute = settings.soundEffectMute;
    }
 public SettingsData(SettingsScript settings)
 {
     volume  = settings.volm;
     quality = settings.quality;
 }
Beispiel #7
0
 void UpdateSound()
 {
     GameObject.Find("Main Camera").GetComponent <AudioSource>().volume = SettingsScript.GetSoundEntry();
 }
Beispiel #8
0
    public bool LoadSettings()
    {
        settingsHolder = GameObject.Find("SettingsHolder");
        if (settingsHolder == null)
        {
            Debug.Log("unable to find settings holder, somethings gone wrong with how this seen was loaded");
            return(false);
        }
        else
        {
            settingsScript   = settingsHolder.GetComponent <SettingsScript>();
            customGameScript = settingsHolder.GetComponent <SettingsCustomGameScript>();
        }


        //set player names (we have no variables/menu for this yet)
        game.names[0] = "Player1";
        game.names[1] = "Player2";
        game.names[2] = "Player3";
        game.names[3] = "Player4";


        //we check the custom game settings for gameplay rules even if not launching a custom game because i'm lazy, it's set from the main menu buttons
        if (customGameScript.gameplayRules == 0) //classic game mode
        {
            Debug.Log("CLASSIC GAME MODE LOADING");
            game.rules           = GameRules.classic;
            game.numberOfPaddles = 2;

            paddles[0].SetControllerType(0); //controller type 0 = keyboard, 1 = mouse, 2 = computer
            paddles[1].SetControllerType(2);
            paddles[2].DisablePaddle();
            paddles[3].DisablePaddle();
        }
        if (customGameScript.gameplayRules == 1) //modern game mode
        {
            Debug.Log("MODERN GAME MODE LOADING");
            game.rules           = GameRules.modern;
            game.numberOfPaddles = 2;

            paddles[0].SetControllerType(0); //controller type 0 = keyboard, 1 = mouse, 2 = computer
            paddles[1].SetControllerType(2);
            paddles[2].DisablePaddle();
            paddles[3].DisablePaddle();
        }
        if (customGameScript.gameplayRules == 2) //4 player mode
        {
            Debug.Log("4PLAYER GAME MODE LOADING");
            game.rules           = GameRules.fourplayer;
            game.numberOfPaddles = 4;

            paddles[0].SetControllerType(0); //controller type 0 = keyboard, 1 = mouse, 2 = computer
            paddles[1].SetControllerType(0);
            paddles[2].SetControllerType(0);
            paddles[3].SetControllerType(0);
        }

        if (customGameScript.launchCustom == true)                           //launched from custom game menu
        {
            if (customGameScript.gameplayRules == 2)                         //2 player
            {
                paddles[0].SetControllerType(customGameScript.slotControl1); //controller type 0 = keyboard, 1 = mouse, 2 = computer
                paddles[1].SetControllerType(customGameScript.slotControl2);
                paddles[2].DisablePaddle();
                paddles[3].DisablePaddle();
            }
            else //4 player
            {
                paddles[0].SetControllerType(customGameScript.slotControl1); //controller type 0 = keyboard, 1 = mouse, 2 = computer
                paddles[1].SetControllerType(customGameScript.slotControl2);
                paddles[2].SetControllerType(customGameScript.slotControl3);
                paddles[3].SetControllerType(customGameScript.slotControl4);
            }
        }
        else //launched from main menu button
        {
        }

        if (settingsScript.camera3D)
        {
            camera3DRef.enabled = true;
            camera2DRef.enabled = false;
            camera2DRef.gameObject.GetComponent <FlareLayer>().enabled    = false;
            camera2DRef.gameObject.GetComponent <AudioListener>().enabled = false;
        }
        else
        {
            camera2DRef.enabled = true;
            camera3DRef.enabled = false;
            camera3DRef.gameObject.GetComponent <FlareLayer>().enabled    = false;
            camera3DRef.gameObject.GetComponent <AudioListener>().enabled = false;
        }

        return(true);
    }
Beispiel #9
0
 void Awake()
 {
     Instance = this;
 }