Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        showLevelsButton = transform.Find("Home/ButtonGame").gameObject;
        editModeButton   = transform.Find("Home/ButtonEditor").gameObject;
        playerNameText   = transform.Find("Home/PlayerNameText").gameObject;
        levelContent     = transform.Find("Levels/Scroll View/Viewport/LevelContent");
        levelInfoPanel   = transform.Find("LevelInfoPanel").gameObject;
        confirmWindow    = transform.Find("ConfirmWindow").gameObject;
        levelsPanel      = transform.Find("Levels").gameObject;
        confirmWindow.SetActive(false);
        levelsPanel.SetActive(false);

        showLevelsButton.GetComponent <Button>().onClick.AddListener(delegate() {
            levelsPanel.SetActive(true);
        });

        editModeButton.GetComponent <Button>().onClick.AddListener(delegate() {
            GameManager.editMode = true;
            SceneManager.LoadScene("Game");
        });

        dontDestroy = GameObject.Find("DontDestroy").GetComponent <DontDestroy>();
        player      = dontDestroy.player;
        playerNameText.GetComponent <Text>().text = player.name;

        LoadMapInfo();
    }
Ejemplo n.º 2
0
    IEnumerator FadeScreen(Image blackFade, bool won)
    {
        while (blackFade.color.a < 1)
        {
            blackFade.color = new Vector4(0, 0, 0, blackFade.color.a + 0.02f);

            yield return(new WaitForSeconds(0.05f));

            if (blackFade.color.a >= 0.95f)
            {
                dontDestroyObject = FindObjectOfType <DontDestroy>();
                if (dontDestroyObject != null)
                {
                    dontDestroyObject.ChangeName();
                }

                if (won)
                {
                    meny.SwitchScene(mainMenu);
                }
                else
                {
                    ResetPositions();
                }
            }
        }
    }
Ejemplo n.º 3
0
    void Start()
    {
        Cursor.visible   = true;
        Cursor.lockState = CursorLockMode.None;

        CameFromScene = FindObjectOfType <DontDestroy>();
        chSelect      = GetComponent <ChapterSelect>();
        print(CameFromScene.gameObject.name);
        switch (CameFromScene.gameObject.name)
        {
        case "Prolog":
            chSelect.SwitchToScene(scenes[0].gameObject);
            print("Prolog");
            break;

        case "Kapitel 1":
            chSelect.SwitchToScene(scenes[1].gameObject);
            print("Kaptiel 1");
            break;

        case "Kapitel 2":
            chSelect.SwitchToScene(scenes[2].gameObject);
            print("Kapitel 2");
            break;

        default:
            print("None of the above");
            chSelect.SwitchToScene(mainMenu);
            break;
        }
    }
Ejemplo n.º 4
0
    private IEnumerator Start()
    {
        StateMachine = GetComponent <StateMachine>();
        _buildingEnvironmatentState = gameObject.AddComponent <BuildingEnvironmatentState>();
        _setupAnimationsState       = gameObject.AddComponent <SetupAnimationsState>();
        _editEnvironmentState       = gameObject.AddComponent <EditEnvironmentState>();
        _viewModeState = gameObject.AddComponent <ViewModeState>();

        StateMachine.States.Add(_buildingEnvironmatentState);
        StateMachine.States.Add(_setupAnimationsState);
        StateMachine.States.Add(_editEnvironmentState);
        StateMachine.States.Add(_viewModeState);

        StateMachine.CurrentState = _viewModeState;
        StateMachine.CurrentState.ActivateState();

        DontDestroy = FindObjectOfType <DontDestroy>();

        while (EnvironmentResourcesManager.isReady == false)
        {
            yield return(null);
        }

        DeserializeSceneContent();
    }
Ejemplo n.º 5
0
    void Start()
    {
        DontDestroy.Clean();

        SGK.LuaController.DisposeInstance();
        Invoke("Reload", 0.2f);
    }
Ejemplo n.º 6
0
 /// <summary>
 /// // DontDestroyOnLoad用
 /// </summary>
 private void OnDestroy()
 {
     if (this == Instance)
     {
         dontDestroy = null;
     }
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     dontDestroy = GameObject.FindGameObjectWithTag("dontdestroy");
     score       = GameObject.FindGameObjectWithTag("finalScore").GetComponent <GUIText>();
     information = dontDestroy.GetComponent <DontDestroy>();
     score.text  = "Score: " + information.totalScore;
     //print ("total score " + information.totalScore);
 }
Ejemplo n.º 8
0
 private void OnDestroy()
 {
     // 破棄時に、登録した実体の解除を行う
     if (this == Instance)
     {
         Instance = null;
     }
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(instance);
     }
 }
    void Start()
    {
        DontDestroy IP = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy");

        getURL = "http://" + IP.QuestionJSON + getURL;

        Keeper = (DontDestroy)GameObject.Find("SessionHash").GetComponent("DontDestroy");
    }
Ejemplo n.º 11
0
    public void btn_main_menu_Click()
    {
        Time.timeScale = 1.0f;

        DontDestroy.DestroyAll();

        SceneManager.LoadScene("title", LoadSceneMode.Single);
    }
Ejemplo n.º 12
0
    private void Start()
    {
        DontDestroy parentFunction = GetComponentInParent <DontDestroy>();

        controllerName = parentFunction.controllerName;
        agent          = GetComponent <UnityEngine.AI.NavMeshAgent>();
        fixSpeed       = speed;
    }
Ejemplo n.º 13
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetAxis("Submit") == 1)
     {
         DontDestroy.removeObject();
         SceneManager.LoadScene(scene);
     }
 }
Ejemplo n.º 14
0
	// Use this for initialization
	void Start () {
		if(instance == null) {
			instance = this;
			DontDestroyOnLoad(gameObject);
		} else {
			Destroy(gameObject);
		}
	}
Ejemplo n.º 15
0
 private void Reset()
 {
     if (File.Exists(Application.persistentDataPath + "/game.fun"))
     {
         File.Delete(Application.persistentDataPath + "/game.fun");
     }
     DontDestroy.DestroyAll();
     SceneManager.LoadScene(0);
 }
Ejemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     keepGO = GameObject.FindGameObjectWithTag("dontdestroy");
     keep   = keepGO.GetComponent <DontDestroy> ();
     //pizzas = 6;
     pizzas   = keep.pizzas;
     duration = Time.time + 50f;
     //	print ("frames per second " + 1.0f / Time.deltaTime);
 }
Ejemplo n.º 17
0
 private static void RestartManagers()
 {
     RoomManager.Restart();
     SchoolManager.Restart();
     GarageManager.Restart();
     TManager.Restart();
     DontDestroy.Restart();
     Clearing();
 }
Ejemplo n.º 18
0
    // Main Start Function
    void Start()
    {
        LoginText    = UsernameField.GetComponentsInChildren <Text>()[0] as Text;
        PasswordText = PasswordField.GetComponentsInChildren <InputField>()[0] as InputField;

        DontDestroy IP = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy");

        getURL = "http://" + IP.QuestionJSON + getURL;
    }
Ejemplo n.º 19
0
	void Awake() {
		if (instance != null && instance != this) {
			Destroy(this.gameObject);
			return;
		} else {
			instance = this;
		}
		DontDestroyOnLoad(this.gameObject);
	}
Ejemplo n.º 20
0
 // Start is called before the first frame update
 void Start()
 {
     if (Instance != null)
     {
         Destroy(this.gameObject);
     }
     Instance = this;
     DontDestroyOnLoad(this.gameObject);
 }
Ejemplo n.º 21
0
    //***************************************************//
    //
    public void goToBattle(string webResult)
    {
        DontDestroy Keeper = (DontDestroy)GameObject.Find("QuestionPacker").GetComponent("DontDestroy");

        Keeper.QuestionJSON = webResult;

        SceneLoader Loader = (SceneLoader)GameObject.Find("SceneManager").GetComponent("SceneLoader");

        Loader.LoadScene("BattleScene");
    }
    public void setIP()
    {
        DontDestroy ServerIPHolder = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy");
        Text        fieldText      = (Text)field.GetComponentsInChildren <Text>()[0] as Text;

        ServerIPHolder.QuestionJSON = fieldText.text;

        lobbymenu.SetActive(true);
        ipconfigmenu.SetActive(false);
    }
 public void OnValidate()
 {
     if (this.editorValidated == false)
     {
                         #pragma warning disable 612,618
         this.dontDestroy     = this.dontDestroyOnLoad == true ? DontDestroy.OnSceneChange : DontDestroy.Auto;
         this.editorValidated = true;
                         #pragma warning restore 612,618
     }
 }
Ejemplo n.º 24
0
 private void Start()
 {
     rWS        = FindObjectOfType <RouletteWheelSpin>();
     wP         = FindObjectOfType <WinningsPayout>();
     nRS        = FindObjectOfType <NumberReaderScript>();
     sBI        = FindObjectOfType <SaveBetInfo>();
     dD         = FindObjectOfType <DontDestroy>();
     winner     = false;
     soundCount = 3;
 }
Ejemplo n.º 25
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(Instance);
         return;
     }
     Destroy(this.gameObject);
 }
Ejemplo n.º 26
0
    public void MenuScene()
    {
        dD = FindObjectOfType <DontDestroy>();

        if (dD != null)
        {
            dD.Destroy();
        }

        SceneManager.LoadScene("Gamescene_Menu");
    }
Ejemplo n.º 27
0
    void Awake()
    {
        if (shared)
        {
            DestroyImmediate(gameObject);
            return;
        }

        shared = this;
        DontDestroyOnLoad(gameObject);
    }
    void Awake()
    {
        //Destorys any copt object that was created when the scene loaded
        DontDestroyOnLoad(this);
        if (FindObjectsOfType(GetType()).Length > 1)
        {
            Destroy(gameObject);
        }

        instance = this;
    }
Ejemplo n.º 29
0
    //**************************************************************//
    // Main Start Function
    void Start()
    {
        DontDestroy IP = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy");

        getURL = "http://" + IP.QuestionJSON + getURL;

        // Initializae Variables
        GOButtonList = new List <GameObject>();
        Keeper       = (DontDestroy)GameObject.Find("SessionHash").GetComponent("DontDestroy");
        StartCoroutine(LoadBattleList());
    }
Ejemplo n.º 30
0
    private void Awake()
    {
        if (current != null)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
        current = this;
    }
Ejemplo n.º 31
0
 public static void removeObject()
 {
     if (instance != null)
     {
         foreach (AudioSource audio in instance.GetComponents <AudioSource>())
         {
             audio.Stop();
         }
         instance = null;
     }
 }
Ejemplo n.º 32
0
 private void Awake()
 {
     if (instance != null)
     {
         DestroyImmediate(this);
     }
     else
     {
         instance = this;
     }
 }
Ejemplo n.º 33
0
    void Start()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this.gameObject);
        instance = this;
    }
Ejemplo n.º 34
0
 void Start()
 {
     if (duplicate)
         //Destroy the game object this script is attached to if it already exists
         DestroyImmediate(gameObject);
     else
     {
         //Causes UI object not to be destroyed when loading a new scene.
         DontDestroyOnLoad(gameObject);
         duplicate = this;
     }
 }
Ejemplo n.º 35
0
 // Use this for initialization
 void Awake()
 {
     DontDestroyOnLoad (this);
     if (instance == null) {
         instance = this;
         Debug.Log ("Test: " + instance);
     } else if (this == instance) {
         Debug.Log ("Hit");
         DontDestroyOnLoad (transform.gameObject);
     } else {
         Debug.Log ("Hit1");
         thatTransform = transform;
         Destroy(this.gameObject);
     }
 }
Ejemplo n.º 36
0
	void Awake() {

		// If there is no instance of this class...
		if (instance == null) {
			// ...then set the instance to this.
			instance = this;
		}
		
		// Otherwise, if an instance does not equal this...
		else if (instance != this) {
			// ...then destroy this game object to enforce the singleton pattern.
			Destroy (gameObject);
		}

		// When a new scene loads, don't destroy this game object.
		DontDestroyOnLoad(this.gameObject);

	}
Ejemplo n.º 37
0
    void Awake()
    {
        //Get a reference to ShowPanels attached to UI object
        showPanels = GetComponent<ShowPanels> ();

        //Get a reference to PlayMusic attached to UI object
        playMusic = GetComponent<PlayMusic> ();

        dontDestroy = GetComponent<DontDestroy> ();

        //Check if there is an existing instance of this object
        if((instance) && (instance.GetInstanceID() != GetInstanceID()))
            DestroyImmediate(gameObject); //Delete duplicate
        else
        {
            instance = this; //Make this object the only instance
            DontDestroyOnLoad (gameObject); //Set as do not destroy
        }
    }