public void Reset() { transform.position = Game.Instance.levels.GetStartPosition(); if ( _title != null ) { Destroy( _title.gameObject ); _title = null; } if ( _winScreen != null ) { Destroy( _winScreen.gameObject ); _winScreen = null; } SpawnTitleObject(); }
void OnTriggerEnter(Collider coll) { //List of players ingame. if (coll.CompareTag("Player")) { PlayerSync player = coll.transform.parent.parent.parent.parent.parent.parent.parent.parent.GetComponent <PlayerSync>(); if (!playersInTheMiddle.Contains(player)) { playersInTheMiddle.Add(player); } //Win check if (playersInTheMiddle.Count == GameObject.Find("Players").GetComponentsInChildren <PlayerSync>().Length) { GameObject.Find("HUD").gameObject.SetActive(false); NetworkVariables nvs = GameObject.FindObjectOfType <NetworkVariables>(); Vector3 walkTo = new Vector3(transform.position.x, player.getController().transform.position.y, transform.position.z); player.getController().Walk(walkTo); int startTime = nvs.startTimestamp; nvs.finishTime = getCurrentTimestamp(); int userTime = nvs.finishTime - startTime; string formattedTime = string.Format("{0:00}:{1:00}:{2:00}", userTime / 3600, (userTime / 60) % 60, userTime % 60); int openedRooms = -2; //Not counting the start and end room int allRooms = -1; //This one will not count the start room, but the end room. int puzzleRooms = 0; int puzzleFinished = 0; foreach (RoomController rc in GameObject.FindObjectsOfType <RoomController>()) { if (rc.displayRoom) { openedRooms++; } if (rc.cameFrom != -1) { allRooms++; //rc.displayRoom = true; } if (rc.getRoomCategory() != RoomObject.RoomCategory.DeadEnd && rc.getRoomCategory() != RoomObject.RoomCategory.End && rc.getRoomCategory() != RoomObject.RoomCategory.Start && rc.getRoomCategory() != RoomObject.RoomCategory.Nothing) { puzzleRooms++; } if (rc.puzzleComplete) { puzzleFinished++; } } GameObject ws = Instantiate(winScreen, Vector3.zero, Quaternion.identity) as GameObject; WinScreen screen = ws.GetComponent <WinScreen>(); screen.timeInSeconds = userTime; screen.roomsOpened = openedRooms; screen.roomCount = allRooms; screen.puzzlesCompleted = puzzleFinished; screen.puzzleCount = puzzleRooms; screen.sizeX = Mathf.RoundToInt(nvs.mazeSize.x); screen.sizeY = Mathf.RoundToInt(nvs.mazeSize.y); screen.mazeSeed = nvs.seed; Destroy(GetComponent <BoxCollider>()); Destroy(this); } } }
// Update is called once per frame void Start () { gameManager = GameObject.FindGameObjectWithTag ("GameManager") as GameObject; if (gameManager == null) { Debug.LogError("Tag GameManager object with the GameManager tag"); } boardManager = gameManager.GetComponent<BoardManager> () as BoardManager; uiManager = gameManager.GetComponent<UIManager> () as UIManager; winScreen = _winScreen.GetComponent<WinScreen>() as WinScreen; Current = View.MainMenu; }
private void Victory() { WinScreen.SetActive(true); }
void Start() { win = winScreen.GetComponent<WinScreen>(); win.chargeLevel (levelToLoad, levelTag); }
private void Awake() { instance = this; boxDisplay.SetActive(false); }
public void NextLevel() { WinScreen winscreen = new WinScreen (_currentLevel, _score, (int)_time, _lives); game.AddChild (winscreen); Destroy (); }
public void Win() { parkingSlots.SetVictoryTexture(); WinScreen.SetActive(true); }
public MainWindow() { InitializeComponent(); //System.Windows.MessageBox.Show($"{new WinScreen(this).ScreenSize}"); //cfg_Json cfg_d = new cfg_Json(); //cfg_d.Config = cfg; //cfg_d.Serialize(); //cfg_d.Deserialize(); //System.Windows.MessageBox.Show(cfg_d.ToString()); #region OpenNewSetttingProgram if (j.IsVoidFile()) { j.OpenJson(); if (j.isOpen) { cfg = j.Config; } else { cfg = new Configuration(); } } else { j.Config = cfg; j.SaveJson(); } Setting(); #endregion timer.Time = cfg.TimeInterval; timer.Tick += Timer_Tick; timer.Start(); audio.StartRecording(); audio.CSmoothHistogram = cfg.CountSmoothHistogram; ntic.Icon = Properties.Resources.Icon_ico; ntic.Visible = true; ntic.MouseClick += delegate(object sender, System.Windows.Forms.MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: break; case MouseButtons.None: break; case MouseButtons.Right: windNotify = windNotify ?? new WindNotify(); // Size size_ = new WinScreen(this).ScreenSize; windNotify.SetSize(size_.X * 0.7, size_.Y * 0.7); windNotify.SetCen(size_.X, size_.Y); windNotify.Show(); windNotify.ColorBoxs[0].Text = $"{cfg.ColorLine.A},{cfg.ColorLine.R},{cfg.ColorLine.G},{cfg.ColorLine.B}"; foreach (var item in windNotify.textBoxes) { windNotify.EventTextChanged(item, EventText_notify); } foreach (var item in windNotify.CheckBoxs) { windNotify.EventMouseDownChanged(item, EventClick); } foreach (var item in windNotify.ColorBoxs) { item.TextCh(EventText_notify); } windNotify.Topmost = true; break; case MouseButtons.Middle: break; case MouseButtons.XButton1: break; case MouseButtons.XButton2: break; default: break; } }; }
public void StopState(GameState pGameState) { switch (pGameState) { case GameState.STARTSCREEN: if (_startScreen != null) { _startScreen.Destroy(); _startScreen = null; } break; case GameState.OPENINGSCREEN: if (_openingScreen != null) { _openingScreen.Destroy(); _openingScreen = null; } break; case GameState.LEVEL: if (_level != null) { if (_level.GetHud() != null) { _level.GetHud().Destroy(); } if (_level.GetBackground() != null) { _level.GetBackground().Destroy(); if (_level.GetBackground().GetBackDrop() != null) { _level.GetBackground().GetBackDrop().Destroy(); } if (_level.GetBackground().GetMidGround() != null) { _level.GetBackground().GetMidGround().Destroy(); } } if (_level.GetForeGround() != null) { _level.GetForeGround().Destroy(); } _level.Destroy(); _level = null; } break; case GameState.LOSESCREEN: if (_loseScreen != null) { _loseScreen.Destroy(); _loseScreen = null; } break; case GameState.WINSCREEN: if (_winScreen != null) { _winScreen.Destroy(); _winScreen = null; } break; default: break; } }
public void Awake() { Instance = this; gameObject.SetActive(false); }
public void StartWinScreen() { _winScreen = new WinScreen(this); AddChild(_winScreen); }
void SpawnScreen( WinScreen screenPrefab ) { Vector3 newPos = Camera.main.transform.position + Vector3.forward * 10f; if ( _winScreen != null ) return; _winScreen = Parenter.InstantiateAndParent( screenPrefab, newPos, Quaternion.identity, Camera.main.transform, "Screen" ); }
private static void MainWindow_MouseButtonPressed(object sender, MouseButtonEventArgs e) { switch (windowModeNow) { case WindowMode.Game: { levelNow.MainCharacter.gunNow.MainCharShoot(Program.levelNow.MainCharacter, new Point(e.X, e.Y)); return; } case WindowMode.Dead: { DeadScreen.Click(); return; } case WindowMode.Menu: { switch (MainMenuChooseNow) { case MainMenuChoose.Exit: { MainWindow_Closed(new object(), new EventArgs()); return; } case MainMenuChoose.Story: { windowModeNow = WindowMode.LevelsChoose; return; } case MainMenuChoose.Arena: { levelNow = new Arena(); levelNow = levelNow.RestartLevel(); levelNow.LoadStuff(); windowModeNow = WindowMode.Game; return; } } return; } case WindowMode.LevelsChoose: { LevelChoosePage.Click(); return; } case WindowMode.Pause: { DeadScreen.Click(); return; } case WindowMode.Win: { WinScreen.Click(); return; } } }
public void end() { Debug.Log(Time.realtimeSinceStartup); WinScreen.setFinishTime(Mathf.Round(Time.realtimeSinceStartup * 100f) / 100f); SceneManager.LoadScene("WinScreen"); }
static void Main(string[] args) { settings.AntialiasingLevel = 8; MainWindow = new RenderWindow(new VideoMode(WidthWindow, HeightWindow), "Story of one Cube", Styles.None, settings); MainWindow.SetVerticalSyncEnabled(true); MainWindow.Closed += MainWindow_Closed; MainWindow.KeyPressed += MainWindow_KeyPressed; MainWindow.KeyReleased += MainWindow_KeyReleased; MainWindow.MouseMoved += MainWindow_MouseMoved; MainWindow.MouseButtonPressed += MainWindow_MouseButtonPressed; MainWindow.SetVerticalSyncEnabled(true); CharacterMovesAnimation.Init(); DeadScreen.Init(MainWindow); WinScreen.Init(MainWindow); MainMenu.Init(MainWindow); Background.Init(MainWindow); Sounds.Init(); Musics.Init(); Inventory.Init(); Interface.Init(); LevelChoosePage.Init(MainWindow); levelNow = new Level1(); Background.Set(0); musicNow = Musics.MainMenu; musicNow.Play(); while (MainWindow.IsOpen) { MainWindow.Clear(); Background.Draw(MainWindow); if (Background.IsLoaded) { if (windowModeNow == WindowMode.Menu) { MainMenu.DrawAndUpdate(MainWindow); } if (windowModeNow == WindowMode.LevelsChoose) { LevelChoosePage.DrawAndUpdate(MainWindow); } if (windowModeNow == WindowMode.Game) { levelNow.Update(MainWindow); levelNow.Draw(MainWindow); } if (windowModeNow == WindowMode.Dead) { levelNow.Draw(MainWindow); DeadScreen.DrawAndUpdate(MainWindow); } if (windowModeNow == WindowMode.Pause) { levelNow.Draw(MainWindow); DeadScreen.DrawAndUpdate(MainWindow); } if (windowModeNow == WindowMode.Win) { levelNow.Draw(MainWindow); WinScreen.DrawAndUpdate(MainWindow); } MainWindow.DispatchEvents(); } MainWindow.Display(); } }
void Awake() { Instance = this; transform.localScale = Vector3.zero; }