Inheritance: MonoBehaviour
Example #1
0
    void OnEnable()
    {
        OptionsScript = GameObject.FindGameObjectWithTag("OptionsMenu").GetComponent <OptionsScript>();

        OptionsButton.onClick.AddListener(delegate { OnOptionsClick(); });
        PlayButton.onClick.AddListener(delegate { OnPlayClick(); });
        ExitButton.onClick.AddListener(delegate { OnExitClick(); });
    }
Example #2
0
 void Start()
 {
     instance = this;
     this.enabled = false;	// The game can enable this script when the game is paused
     GameObject player = GameObject.FindWithTag("Player");
     characterScript = player.GetComponent<CharacterScript>();
     optionsScript = transform.parent.GetComponentInChildren<OptionsScript>();
 }
 public void Start()
 {
     Instance = this;
     mScript = GameObject.Find("Main Camera").GetComponent<MenuController>();
     psScript = GameObject.Find("PlayerSettings").GetComponent<PlayerSettingsScript>();
     screenWidth = Screen.width;
     screenHeight = Screen.height;
     groupWidth = 420f;
     groupHeight = 330f;
     setWidth = (screenWidth - groupWidth);
     setHeight = (screenHeight - groupHeight);
 }
    void Awake()
    {
        Instance = this;
        menuObject = GameObject.Find("MainMenu");
        mScript = menuObject.GetComponent<MenuScript>();
        gameMObject = GameObject.Find("GameModes");
        gmScript = gameMObject.GetComponent<GameModeScript>();
        optionsObject = GameObject.Find("Options");
        oScript = optionsObject.GetComponent<OptionsScript>();

        menuActive = true;
        optionsActive = false;
        modesActive = false;
    }
Example #5
0
    public AudioClip btnClickClip;      //Btn click

    // Use this for initialization
    void Start()
    {
        OptionsScript optionsManager = GameObject.FindGameObjectWithTag("Options").GetComponent <OptionsScript>();

        //Disable music if needed
        if (!optionsManager.MusicOn)
        {
            backgroundSource.gameObject.SetActive(false);
        }

        if (!optionsManager.SFXOn)
        {
            soundEffectsSource.gameObject.SetActive(false);
        }
    }
    // Use this for initialization
    void Start()
    {
        //Find script
        progressScript = GameObject.FindGameObjectWithTag("AvatarTransfer").GetComponent <AvatarProgress>();

        ChangeBackgroundMusic(progressScript.level);

        //OPTIONS
        OptionsScript optionsManager = GameObject.FindGameObjectWithTag("Options").GetComponent <OptionsScript>();

        //Disable music if needed
        if (!optionsManager.MusicOn)
        {
            backgrounSource.gameObject.SetActive(false);
        }

        if (!optionsManager.SFXOn)
        {
            soundEffectsSource.gameObject.SetActive(false);
            soundEffectsSource2.gameObject.SetActive(false);
        }
    }
Example #7
0
    // Use this for initialization
    void Start()
    {
        this.gameScript = this.gameObject.GetComponent ("GameControllerScript") as GameControllerScript;
        this.options = this.gameObject.GetComponent ("OptionsScript") as OptionsScript;
        this.currentGUISkin = gameScript.currentGUISkin;
        this.InitTimer ();

        AudioSource[] audioSources = GetComponents<AudioSource>();
        this.countdownAudioSource = audioSources[2];
        countdownAudioSource.clip = this.countdownSound;
    }
 // Use this for initialization
 void Start()
 {
     optionsManager = GameObject.FindGameObjectWithTag("Options").GetComponent <OptionsScript>();
 }
    void Start()
    {
        int x;
        int y;
        int z;
        int axis;
        yOffset = 1F;
        Transform blockInstance;
        BlockScript blockScript;
        ConnectorScript connectorScript;
        Transform connectorInstance;
        TextMesh textMesh;

        this.gameView = "menu";
        this.options = this.gameObject.GetComponent ("OptionsScript") as OptionsScript;
        this.timer = this.gameObject.GetComponent ("TimerScript") as TimerScript;
        this.sizeGUI();

        this.options.InitOptions();

        //setup audio sources

        AudioSource[] audioSources = GetComponents<AudioSource>();
        this.swipeAudioSource = audioSources[0];
        this.collideAudioSource = audioSources[1];
        this.collideAudioSource.clip = this.collideSound;

        //instantiate the blocks and connectors and position them
        for (x = 0; x <= 2; x++) {
            for (y = 0; y <= 2; y++) {
                for (z = 0; z <= 2; z++) {
                    //instantiate the block
                    blockInstance = Instantiate (block, new Vector3(x * this.scale, y * this.scale + this.yOffset, z * this.scale), Quaternion.identity) as Transform;
                    this.blocks[x,y,z] = blockInstance;
                    blockScript = blockInstance.gameObject.GetComponent("BlockScript") as BlockScript;
                    blockScript.Initialize(x,y,z,this);
                }
            }
        }

        // instantiate the connectors
        for (x = 0; x <= 2; x++) {
            for (y = 0; y <= 2; y++) {
                for (z = 0; z <= 2; z++) {
                    //instantiate the x connector
                    connectorInstance = Instantiate (connector) as Transform;
                    connectorScript = connectorInstance.gameObject.GetComponent("ConnectorScript") as ConnectorScript;
                    connectorScript.Initialize(x,y,z,"x", this);
                    this.connectors[x,y,z,0] = connectorInstance;

                    //instantiate the y connector
                    connectorInstance = Instantiate (connector) as Transform;
                    connectorScript = connectorInstance.gameObject.GetComponent("ConnectorScript") as ConnectorScript;
                    connectorScript.Initialize(x,y,z,"y", this);
                    this.connectors[x,y,z,1] = connectorInstance;

                    //instantiate the z connector
                    connectorInstance = Instantiate (connector) as Transform;
                    connectorScript = connectorInstance.gameObject.GetComponent("ConnectorScript") as ConnectorScript;
                    connectorScript.Initialize(x,y,z,"z", this);
                    this.connectors[x,y,z,2] = connectorInstance;
                }
            }
        }

        //instantiate the move blocks
        if (PlayerPrefs.HasKey ("game_status")) {
            this.loadSavedGame();
        }
        else {
            this.restart ();
        }
    }
Example #10
0
    // Start is called before the first frame update
    void Start()
    {
        //The reset will occur after the time input has passed
        Invoke("ResetTime", resetTime);

        //Calls the make room function from the Room maker script on the game manager
        GetComponent <RoomMaker>().MakeRoom();

        //Finds the options script and turns it on
        OptionsScript options = FindObjectOfType <OptionsScript>();

        options.enabled = true;

        objects = GameObject.FindGameObjectsWithTag("Properties");

        foreach (GameObject iObject in objects)
        {
            if (iObject.GetComponent <ObjectInGame>() == null)
            {
                iObject.AddComponent <ObjectInGame>();
            }
        }

        //This will go through every object in the game with the tag properties and sort it into lists depending it's property type
        //Some objects will have more than one property type and therefore will appear in multiple lists.
        for (int i = 0; i < objects.Length; i++)
        {
            if (objects[i].GetComponent <ObjectInGame>())
            {
                for (int j = 0; j < objects[i].GetComponent <ObjectInGame>().properties.type.Length; j++)
                {
                    switch (objects[i].GetComponent <ObjectInGame>().properties.type[j])
                    {
                    case ObjectProperties.property.Color:
                        colorObjects.Add(objects[i]);
                        break;

                    case ObjectProperties.property.Form:
                        formObjects.Add(objects[i]);
                        break;

                    case ObjectProperties.property.Light:
                        lightObjects.Add(objects[i]);
                        break;

                    case ObjectProperties.property.Line:
                        lineObjects.Add(objects[i]);
                        break;

                    case ObjectProperties.property.Pattern:
                        patternObjects.Add(objects[i]);
                        break;

                    case ObjectProperties.property.Space:
                        spaceObjects.Add(objects[i]);
                        break;

                    case ObjectProperties.property.Texture:
                        textureObjects.Add(objects[i]);
                        break;

                    default:
                        break;
                    }
                }
            }
        }
    }
Example #11
0
	void Awake()
	{
		_instance = this;
	}