// public LightScript lightScript; //Start private void Start() { //zone1.SetActive(true); //zone2.SetActive(false); inUpDraft = false; audio = FindObjectOfType <AudioManager>(); creditsMenu = GameObject.Find("Credits Menu"); creditsMenu.SetActive(false); //Calling Scripts debugLines = GetComponent <DebugLines>(); flyingStates = GetComponent <FlyingStates>(); playerCollider = GetComponent <BoxCollider>(); camFollow = GetComponent <CamFollow>(); input = GetComponent <InputManager>(); rotationController = GetComponent <RotationController>(); animationScript = GetComponent <AnimationScript>(); loadLevel = GetComponent <LoadLevel>(); // lightScript.light.color = lightScript.Cavecolor; //boostLight.SetActive(false); //windStream.SetActive(false); flyingStates.WingStreamsOff(); FindObjectOfType <AudioManager>().StopPlayingAudio("Boost"); EndGameUI.SetActive(false); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { LoadLevel.LoadScene(sceneToLoad); } }
void Start() { if (loader == null) { loader = new LoadLevel(); } }
private void OnLoadLevel(LoadLevel L) { ConnectedMovingPlatform = null; speed = Vector2.zero; DashSpeed = Vector2.zero; PlatformSpeed = Vector2.zero; }
/// <summary> /// Player was requested to load a new level /// </summary> private void OnPacketLoadLevel(ref LoadLevel p) { int i = p.LevelName.IndexOf('/'); if (i == -1) { return; } string serverName = p.ServerName; string episodeName = p.LevelName.Substring(0, i); string levelName = p.LevelName.Substring(i + 1); byte playerIndex = p.AssignedPlayerIndex; MultiplayerLevelType levelType = p.LevelType; Await.NextAfterUpdate().OnCompleted(() => { LevelInitialization levelInit = new LevelInitialization(episodeName, levelName, GameDifficulty.Multiplayer); Scene.Current.Dispose(); Scene.SwitchTo(new MultiplayerLevelHandler(this, client, levelInit, levelType, playerIndex)); GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); GC.WaitForPendingFinalizers(); GCSettings.LatencyMode = GCLatencyMode.LowLatency; ControlScheme.IsSuspended = false; UpdateRichPresence(levelInit, serverName); }); }
private void Awake() { // Make sure there's only ever one instance of GameStateMachine if (_instance != null) { Destroy(this.gameObject); return; } _instance = this; DontDestroyOnLoad(this.gameObject); // Create a base StateMachine and hook into it's OnStateChanged _stateMachine = new StateMachine(); _stateMachine.OnStateChanged += state => OnGameStateChanged?.Invoke(state); // Create our states and default to the Menu state var menu = new Menu(); var loading = new LoadLevel(); var play = new Play(); var pause = new Pause(); _stateMachine.SetState(menu); // Create all of our game state transitions _stateMachine.AddTransition(menu, loading, () => PlayButton.LevelToLoad != null); _stateMachine.AddTransition(loading, play, loading.Finished); _stateMachine.AddTransition(play, pause, () => PlayerInput.Instance.PausePressed); _stateMachine.AddTransition(pause, play, () => PlayerInput.Instance.PausePressed); _stateMachine.AddTransition(pause, menu, () => RestartButton.Pressed); }
private void SpawnLevelPrefab() { var levelClone = Instantiate(_levelPrefab); levelClone.transform.parent = _levelSpawner.transform; LoadLevel?.Invoke(); }
// Use this for initialization void Start() { rb = ufo.GetComponent <Rigidbody2D>(); GenerateRandomForce(); UfoShoot(); lvl = new LoadLevel(); }
public void Load() { PlayerData data = SaveState.LoadPlayer(); if (data != null) { Debug.Log("loading player data..."); maxHealth = data.maxHealth; currentHealth = data.currentHealth; if (healthBar != null) { healthBar.SetMaxHealth(maxHealth); healthBar.SetHealth(currentHealth); } currentScene = data.level; LoadLevel.LoadScene(data.level); Vector3 position; position.x = data.position[0]; position.y = data.position[1]; position.z = data.position[2]; transform.parent.position = position; loaded = true; } }
private void OnLoadLevel(LoadLevel L) { if (activated && ThisMemory) { StartCoroutine(Fade()); } }
private void Awake() { sceneindex = SaveGame.Load <int>("level"); loadlevel = GameObject.Find("Main").GetComponent <LoadLevel>(); }
private void Start() { _loadLevel = GetComponent <LoadLevel>(); _levelButton = GetComponent <LevelButton>(); _canvasGroup = GetComponent <CanvasGroup>(); _currentLevelName = _loadLevel.SceneName; if (!_isUnlock) { if (PlayerPrefs.HasKey(_currentLevelName)) { _isUnlock = true; _canvasGroup.alpha = 1; _canvasGroup.interactable = true; } } if (_isUnlock) { if (PlayerPrefs.GetInt(_currentLevelName) >= PlayerPrefs.GetInt($"previous {_currentLevelName}") || !PlayerPrefs.HasKey($"previous {_currentLevelName}")) { _levelButton.SetSpritesOfStars(PlayerPrefs.GetInt(_currentLevelName)); PlayerPrefs.SetInt($"previous {_currentLevelName}", PlayerPrefs.GetInt(_currentLevelName)); } else { _levelButton.SetSpritesOfStars(PlayerPrefs.GetInt($"previous {_currentLevelName}")); } } }
private void OnTriggerEnter2D(Collider2D collider) { if (collider.CompareTag("Player")) { LoadLevel.LoadNextLevel(); } }
// public string LevelFolderPath; // Use this for initialization void Start() { LoadLevel levelLoadedCore = GetComponent <LoadLevel>(); if (levelLoadedCore == null) { gameObject.AddComponent <LoadLevel>(); levelLoadedCore = GetComponent <LoadLevel>(); } SimpleLevel LevelGeo = new SimpleLevel(LevelPathGeometry); levelLoadedCore.LevelGeometryDictonary = LevelGeometryDictonary; levelLoadedCore.SimpleLevel = LevelGeo; SendMessage("loadLevelAndProess"); SimpleLevel LevelDeco = new SimpleLevel(LevelPathDeco); levelLoadedCore.LevelGeometryDictonary = LevelGeometryDictonaryDecoAndAI; levelLoadedCore.SimpleLevel = LevelDeco; SendMessage("loadExtraLevelPart"); // TODO: make this Dynamic and fitting to the current Loaded map /*Pathfinder pf = GameObject.Find("Pathfinder").GetComponent<Pathfinder>(); * pf.MapEndPosition = new Vector2(-200, -200); * pf.MapStartPosition = new Vector2(200, 200);*/ }
private void Start() { if (instance == null) { instance = this; } }
// Start is called before the first frame update void Start() { DOLDatabase DOLD = GameObject.FindGameObjectWithTag("LoadManager").GetComponent <DOLDatabase>(); DontDestroyOnLoad(Player); DOLD.Add(Player); DontDestroyOnLoad(UICanvas); DOLD.Add(UICanvas.gameObject); DontDestroyOnLoad(Manager); DOLD.Add(Manager); DontDestroyOnLoad(TileMapManager); DOLD.Add(TileMapManager); DontDestroyOnLoad(LoadManager); DOLD.Add(LoadManager); DontDestroyOnLoad(ItemManager); DOLD.Add(ItemManager); DontDestroyOnLoad(XML); DOLD.Add(XML.gameObject); /*TEST REMOVE AFTER*/ //Player.transform.position = new Vector3(9, 12, 0); Clock cClock = GameObject.FindGameObjectWithTag("Canvas").GetComponent <Clock>(); LoadLevel Load = GameObject.FindGameObjectWithTag("LoadManager").GetComponent <LoadLevel>(); if (SceneManager.GetActiveScene().name != "LoadSaveScene") { Load.TransferLevel("PlayerFarm", new Vector3(0, 0, 0)); } else { Load.TransferLevel(cClock.SceneName, cClock.PlayerPos); } }
private void OnNetworkLoadLevel(ref LoadLevel p) { string episodeName; string levelName = p.LevelName; int i = levelName.IndexOf('/'); if (i != -1) { episodeName = levelName.Substring(0, i); levelName = levelName.Substring(i + 1); } else { return; } byte playerIndex = p.AssignedPlayerIndex; DispatchToMainThread(delegate { Scene.Current.Dispose(); NetworkLevelHandler handler = new NetworkLevelHandler(this, net, new LevelInitialization(episodeName, levelName, GameDifficulty.Multiplayer), playerIndex); Scene.SwitchTo(handler); }); }
/// <summary> /// Получает имя ресурса /// </summary> /// <param name="level"></param> /// <param name="pathtype"></param> /// <returns></returns> public string GetFileName(LoadLevel level, FileSearchResultType pathtype = FileSearchResultType.FullPath) { Resolver = Resolver ?? Application.Current.Files; var name = "~/.tmp/load." + level.ToString().ToLower() + ".js"; return(Resolver.Resolve(name, false, pathtype: pathtype)); }
private void HandleEvent(TutorialEvent tutorialEvent) { switch (tutorialEvent) { case TutorialEvent.NONE: break; case TutorialEvent.LOAD_PRESET_LEVEL: LevelSelectGUI.currentLevel = Levels.GetLevel(level); Loading.Load(level); break; case TutorialEvent.LOAD_NEXT_LEVEL: LoadLevel.LoadALevel("next"); break; case TutorialEvent.START_PLAYER: tutorialEnabled = false; // Disable buttons lastButton.interactable = false; nextButton.interactable = false; skipButton.interactable = false; // Get rid of mainCamera tag //tag = "Untagged"; // Unfreeze camera { //theCamera.active = true; theCamera.GetComponent <LevelStart>().Start(); } // Unfreeze player GameObject player = GameObject.Find("Player"); if (player != null) { player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation; } // Disable tutorial camera //gameObject.active = false; this.enabled = false; break; case TutorialEvent.PLAY_RECORDING: string test = "Recordings/" + points[index].recordingName; TextAsset ta = (TextAsset)Resources.Load(test); Stream s = new MemoryStream(ta.bytes); BinaryReader br = new BinaryReader(s); GameRecorder.StartPlaybackTutorial(Recording.Read(br)); break; case TutorialEvent.RESET_PLAYER: GameRecorder.StopPlayback(); GameObject.Find("Player").BroadcastMessage("Reload"); break; } }
// Start is called before the first frame update void Start() { transform.position = spawnPoint.position; rb = GetComponent <Rigidbody2D>(); playerAnim = GetComponent <PlayerAnimation>(); wallJumpDirection.Normalize(); // -> Set Vector to 1 loadLevel = GameObject.FindGameObjectWithTag("LevelLoader").GetComponent <LoadLevel>(); }
public void Valid_Level_Split(int setnumber,LoadLevel level, string contains) { var raw = PackageGenerator.Get(setnumber); var result = new LoadPackageSet(raw); var subset = result[level]; var str = Stringify(subset); Console.WriteLine(str); Assert.True(Regex.IsMatch(str,contains)); }
public void LoadMainMenu() { Time.timeScale = 1f; Debug.Log("Loading menu..."); LoadLevel.LoadScene(0); //SceneManager.LoadScene(0); }
public void SetLevel(string levelFileName) { GameController.gameController.levelName = levelFileName; LoadLevel loadLevel = gameObject.GetComponent <LoadLevel>(); GameController.gameController.numOfRows = loadLevel.GetLevelRows(levelFileName); GameController.gameController.numOfCols = loadLevel.GetLevelCols(levelFileName); }
// Update is called once per frame void Update() { //Debug.Log(Constants.timeLeft); countdown.text = "Time Remaining - " + Constants.timeLeft; if (Constants.timeLeft <= 1) { LoadLevel.exit(); } }
private void OnLoadLevel(LoadLevel L) { StopAllCoroutines(); InPathEnd = false; ConnectedPath = null; AbleToClimb = false; PathEndThrough = false; IsClimbing = false; }
public Entity GetEntityByUniqueValue(string fieldTypeId, string value, LoadLevel level) { if (!_uniqueValues.TryGetValue(value, out int entityId)) { return(null); } return(GetEntity(entityId, level)); }
void PlayerPassOut() { // Start the play transition Stam.SetStamina(75); NightUpdate(); LoadLevel Load = GameObject.FindGameObjectWithTag("LoadManager").GetComponent <LoadLevel>(); Load.TransferLevel("PlayerRoom", new Vector3(-1, 9, 0)); }
public void Valid_Level_Split(int setnumber, LoadLevel level, string contains) { var raw = PackageGenerator.Get(setnumber); var result = new LoadPackageSet(raw); var subset = result[level]; var str = Stringify(subset); Console.WriteLine(str); Assert.True(Regex.IsMatch(str, contains)); }
private void AddSceneToUI(string scene) { GameObject newGameObject = Instantiate(prefab, transform); LoadLevel loadLevelScript = newGameObject.GetComponent <LoadLevel>(); string levelID = scene.Split("_.".ToCharArray())[1]; newGameObject.transform.Find("Text").GetComponent <TMP_Text>().text = levelID; loadLevelScript.level = levelID; loadLevelScript.btn = newGameObject.GetComponentInChildren <Button>(); }
void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); }
{ private void OnTriggerEnter2D(Collider2D collider) { Debug.Log("Checking collision with landmine."); string colliderTag = collider.tag; if (colliderTag == "Player") { Debug.Log("Player hit landmine."); LoadLevel.LoadCurrentLevel(); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); InitLevel(); }
private void nextLevel() { float t = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<AudioSource>().time; pdc.menuMusicTime = t; var ll = new LoadLevel(); foreach(var score in pdc.scores){ if(score.score == 5){ Application.LoadLevel("Podiums_Set_02"); return; } } Application.LoadLevel(ll.GetRandomLevel()); }
// Use this for initialization void Start () { currentSeq = ""; beat = 60.0f / bpm; offset = Time.time % (beat); // Translation of directions to move vectors moveList = new Dictionary<string, string>(); moveVectors = new Dictionary<char, Vector3>(); moveVectors['u'] = new Vector3(0, 1, 0); moveVectors['d'] = new Vector3(0, -1, 0); moveVectors['l'] = new Vector3(-1, 0, 0); moveVectors['r'] = new Vector3(1, 0, 0); string moves = moveText.text.Replace("\r",""); foreach(string line in moves.Split('\n')) { string[] mt = line.Split(':'); moveList[mt[1]] = mt[0]; } levelLoader = GetComponent<LoadLevel>(); levelLogic = levelLoader.GetLevelController (); }
public void Start() { _loadLevels = FindObjectOfType<LoadLevel>(); _overlayManager = GetComponentInParent<OverlayManager>(); }
// Update is called once per frame void Update() { if(Input.GetKey("joystick 1 button 0")){ if(P1_PressA.renderer.enabled == true){ pcc.AddPlayer("1"); SelectSound.Play(); } P1_OK.renderer.enabled = true; P1_PressA.renderer.enabled = false; } if(Input.GetKey("joystick 2 button 0")){ if(P2_PressA.renderer.enabled == true){ pcc.AddPlayer("2"); SelectSound.Play(); } P2_OK.renderer.enabled = true; P2_PressA.renderer.enabled = false; } if(Input.GetKey("joystick 3 button 0")){ if(P3_PressA.renderer.enabled == true){ pcc.AddPlayer("3"); SelectSound.Play(); } P3_OK.renderer.enabled = true; P3_PressA.renderer.enabled = false; } if(Input.GetKey("joystick 4 button 0")){ if(P4_PressA.renderer.enabled == true){ pcc.AddPlayer("4"); SelectSound.Play(); } P4_OK.renderer.enabled = true; P4_PressA.renderer.enabled = false; } for(int i = 1; i < 5; i++){ if(Input.GetKey("joystick " + i.ToString() + " button 7")){ if(pcc.PlayerCount > 1){ DontDestroyOnLoad(pcc); var ll = new LoadLevel(); pcc.menuMusicTime = 0; Application.LoadLevel(ll.GetRandomLevel()); } } } }
/// <summary> /// Получает имя ресурса /// </summary> /// <param name="level"></param> /// <param name="pathtype"></param> /// <returns></returns> public string GetFileName(LoadLevel level, FileSearchResultType pathtype = FileSearchResultType.FullPath) { Resolver = Resolver ?? Application.Current.Files; var name = "~/.tmp/load." + level.ToString().ToLower() + ".js"; return Resolver.Resolve(name, false, pathtype: pathtype); }