private void Update() { var ll = LevelTrack.indexToString(Application.loadedLevel); if (ll.Equals("StartPage") || ll.Equals("Phone") || ll.Equals("HomeTV") || ll.Equals("Credits") || ll.Equals("Instructions_1") || ll.Equals("Instructions_2") || ll.Equals("Instructions_3") || ll.Equals("Instructions_4") || ll.Equals("Instructions_5") || ll.Equals("Computer") || ll.Equals("4D") || ll.Equals("CompleteQuest") || ll.Equals("FailQuest") || ll.Equals("ExitQuest") || ll.Equals("EndGame") || ll.Equals("Phone") || ll.Equals("HomeTV") || ll.Equals("Menu") || ll.Equals("Instructions_6") || ll.Equals("Instructions_7") || ll.Equals("Instructions_8")) { hide = true; } else { hide = false; } if (gameObject.tag == "Text") { GetComponent <GUIText>().text = "Days Left: " + daysLeft; if (hide) { GetComponent <GUIText>().text = ""; } } if ((ll.Equals("Home") || ll.Equals("Town") || ll.Equals("Office")) && daysLeft <= 0 && (!lose || !LevelTrack.indexToString(Application.loadedLevel).Equals("EndGame"))) { lose = true; GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>().fade("EndGame"); } }
private void Update() { //GetComponent<Camera>().orthographicSize = Screen.height/100f/4f; var ll = LevelTrack.indexToString(Application.loadedLevel); transform.position = Vector3.Lerp(transform.position, player.transform.position + new Vector3(0, 20, 0), 1f); if (ll.Equals("Forest3D")) { if (transform.position.x < -12.7f) { transform.position = new Vector3(-12.7f, transform.position.y, transform.position.z); } if (transform.position.x > 13.9f) { transform.position = new Vector3(13.9f, transform.position.y, transform.position.z); } if (transform.position.z > 9.8f) { transform.position = new Vector3(transform.position.x, transform.position.y, 9.8f); } if (transform.position.z < -10.1f) { transform.position = new Vector3(transform.position.x, transform.position.y, -10.1f); } } }
private void Start() { rb = GetComponent <Rigidbody>(); if (!LevelTrack.indexToString(LevelTrack.prevLevel).Equals("Phone")) { transform.position = new Vector3(-30, 0, -1.6f); } }
// Update is called once per frame private void Update() { if (Input.GetMouseButtonDown(0)) { if (r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { var ll = LevelTrack.indexToString(Application.loadedLevel); if (ll.Equals("Instructions_1") || ll.Equals("Credits")) { Application.LoadLevel(LevelTrack.prevLevel); } else if (ll.Equals("Instructions_2")) { Application.LoadLevel("Instructions_1"); } else if (ll.Equals("Instructions_3")) { Application.LoadLevel("Instructions_2"); } else if (ll.Equals("Instructions_4")) { Application.LoadLevel("Instructions_3"); } else if (ll.Equals("Instructions_5")) { Application.LoadLevel("Instructions_4"); } else if (ll.Equals("Instructions_6")) { Application.LoadLevel("Instructions_5"); } else if (ll.Equals("Instructions_7")) { Application.LoadLevel("Instructions_6"); } else if (ll.Equals("Instructions_8")) { Application.LoadLevel("Instructions_7"); } } } if (!isOver && r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { isOver = true; transform.localScale += new Vector3(0.1f, 0.1f, 0); } if (isOver && !r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { isOver = false; transform.localScale -= new Vector3(0.1f, 0.1f, 0); } }
public void show() { if (hidden) { if (LevelTrack.indexToString(Application.loadedLevel).Equals("Quest7BossBattle")) { pos = new Vector2(550, 100); } else { pos = new Vector2(300, 20); } hidden = false; } }
public void fade(int level) { var s = LevelTrack.indexToString(Application.loadedLevel); if (!s.Equals("4D") && !s.Equals("Instructions_1") && !s.Equals("Instructions_2") && !s.Equals("Instructions_3") && !s.Equals("Instructions_4") && !s.Equals("Instructions_5") && !s.Equals("Instructions_6") && !s.Equals("Instructions_7") && !s.Equals("Instructions_8")) { LevelTrack.prevLevel = Application.loadedLevel; } Debug.Log("Overloaded fade called " + s); curr = 1; nextLevel = LevelTrack.indexToString(level); fadeToBlack(); }
// Update is called once per frame private void Update() { var ll = LevelTrack.indexToString(Application.loadedLevel); if (ll.Equals("StartPage") || ll.Equals("Menu") || ll.Equals("Credits") || ll.Equals("Introduction") || ll.Equals("Instructions_1") || ll.Equals("Instructions_2") || ll.Equals("Instructions_3") || ll.Equals("Instructions_4") || ll.Equals("Instructions_5") || ll.Equals("4D") || ll.Equals("CounsellingCentre") || ll.Equals("Sleep") || ll.Equals("EndGame") || ll.Equals("Computer") || ll.Equals("Phone") || ll.Equals("Quest5") || ll.Equals("FailQuest") || ll.Equals("ExitQuest") || ll.Equals("HomeTV") || ll.Equals("CompleteQuest") || ll.Equals("Quest10") || ll.Equals("Quest7BossBattle") || ll.Equals("Instructions_6") || ll.Equals("Instructions_7") || ll.Equals("Instructions_8") || ll.Equals("slotmachine")) { gt.enabled = false; } else { gt.enabled = true; } if (gt.enabled && r.Contains(Input.mousePosition)) { gt.texture = mouseOver; if (Input.GetMouseButtonDown(0)) { //prevLoc = GameObject.FindGameObjectWithTag("Player").transform.position; //Debug.Log(prevLoc.ToString("G4")); prevName.Clear(); prevPos.Clear(); var g = FindObjectsOfType <GameObject>(); for (var i = 0; i < g.Length; i++) { prevName.Add(g[i].gameObject.name); prevPos.Add(g[i].transform.position); } prevLevel = Application.loadedLevel; GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>().fade("Phone"); } } else if (gt.enabled) { gt.texture = normal; } }
public void fade(string level) { if (isFading) { return; } var s = LevelTrack.indexToString(Application.loadedLevel); if (!s.Equals("4D") && !s.Equals("Instructions_1") && !s.Equals("Instructions_2") && !s.Equals("Instructions_3") && !s.Equals("Instructions_4") && !s.Equals("Instructions_5") && !s.Equals("Instructions_6") && !s.Equals("Instructions_7") && !s.Equals("Instructions_8")) { LevelTrack.prevLevel = Application.loadedLevel; } Debug.Log("Fade called " + level); curr = 1; nextLevel = level; isFading = true; fadeToBlack(); }
public void set() { var prev = LevelTrack.indexToString(LevelTrack.prevLevel); Debug.Log(prev); if (prev.Equals("Town") || prev.Equals("Home") || prev.Equals("Casino") || prev.Equals("Office")) { rend.sprite = townMap; } else if (prev.Equals("Forest3D")) { rend.sprite = forestMap; } else if (prev.Equals("Dungeon")) { rend.sprite = dungeonMap; } else { rend.sprite = null; } }
private void Update() { var ll = LevelTrack.indexToString(Application.loadedLevel); if (ll.Equals("StartPage") || ll.Equals("Phone") || ll.Equals("HomeTV") || ll.Equals("Credits") || ll.Equals("Instructions_1") || ll.Equals("Instructions_2") || ll.Equals("Instructions_3") || ll.Equals("Instructions_4") || ll.Equals("Instructions_5") || ll.Equals("Computer") || ll.Equals("4D") || ll.Equals("CompleteQuest") || ll.Equals("FailQuest") || ll.Equals("ExitQuest") || ll.Equals("EndGame") || ll.Equals("Phone") || ll.Equals("HomeTV") || ll.Equals("Menu") || ll.Equals("Instructions_6") || ll.Equals("Instructions_7") || ll.Equals("Instructions_8")) { hide = true; } else { hide = false; } if (gameObject.tag == "Text") { GetComponent <GUIText>().text = "Money: $" + amt + "\nDebt: $" + GameProperties.debt; if (hide) { GetComponent <GUIText>().text = ""; } } if ((ll.Equals("Home") || ll.Equals("Town") || ll.Equals("Office")) && amt + TextBoxBank.getBalance() > GameProperties.debt && (!win || !Application.loadedLevelName.Equals("EndGame"))) { Debug.Log("win by money"); win = true; GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>().fade("EndGame"); } else if (amt < 0) { GameProperties.debt -= amt; amt = 0; } }
// Update is called once per frame private void Update() { transform.position = Vector3.Lerp(transform.position, player.transform.position - new Vector3(0, 0, 10), 1f); var ll = LevelTrack.indexToString(Application.loadedLevel); if (ll.Equals("Town")) { if (transform.position.x < -3.3) { transform.position = new Vector3(-3.3f, transform.position.y, -10); } if (transform.position.x > 4) { transform.position = new Vector3(4f, transform.position.y, -10); } if (transform.position.y < -3) { transform.position = new Vector3(transform.position.x, -3, -10); } if (transform.position.y > 2.4f) { transform.position = new Vector3(transform.position.x, 2.4f, -10); } } if (ll.Equals("Office")) { transform.position = new Vector3(transform.position.x, 0, -10); if (transform.position.x < -0.45f) { transform.position = new Vector3(-0.45f, transform.position.y, -10); } if (transform.position.x > 0.45f) { transform.position = new Vector3(0.45f, transform.position.y, -10); } } if (ll.Equals("Casino")) { if (transform.position.x < 0.3f) { transform.position = new Vector3(0.3f, transform.position.y, -10); } if (transform.position.x > 2.1f) { transform.position = new Vector3(2.1f, transform.position.y, -10); } if (transform.position.y < -1.2f) { transform.position = new Vector3(transform.position.x, -1.2f, -10); } if (transform.position.y > 1.9f) { transform.position = new Vector3(transform.position.x, 1.9f, -10); } } if (ll.Equals("Home")) { if (transform.position.x < -0.95f) { transform.position = new Vector3(-0.95f, transform.position.y, -10); } if (transform.position.x > 0.95f) { transform.position = new Vector3(0.95f, transform.position.y, -10); } if (transform.position.y < -0.4) { transform.position = new Vector3(transform.position.x, -0.4f, -10); } if (transform.position.y > 0.36) { transform.position = new Vector3(transform.position.x, 0.36f, -10); } } if (ll.Equals("CounsellingCentre")) { transform.position = new Vector3(transform.position.x, -1.92f, -10); if (transform.position.x < 2.85f) { transform.position = new Vector3(2.85f, transform.position.y, -10); } if (transform.position.x > 3.85f) { transform.position = new Vector3(3.85f, transform.position.y, -10); } } if (ll.Equals("Bank")) { if (transform.position.y < -0.35f) { transform.position = new Vector3(transform.position.x, -0.35f, -10); } if (transform.position.y > 0.4f) { transform.position = new Vector3(transform.position.x, 0.4f, -10); } if (transform.position.x < -0.7f) { transform.position = new Vector3(-0.7f, transform.position.y, -10); } if (transform.position.x > 0.22f) { transform.position = new Vector3(0.22f, transform.position.y, -10); } } }
private void Start() { var ll = LevelTrack.indexToString(Application.loadedLevel); var prev = LevelTrack.indexToString(LevelTrack.prevLevel); var player = GameObject.FindWithTag("Player"); if (ll.Equals("StartPage")) { Debug.Log("Menu"); Application.LoadLevel("Menu"); Debug.Log("Loaded menu"); } if (ll.Equals("Computer")) { Debug.Log("computer"); GameObject.Find("Computer").GetComponent <ComputerData>().showScreen(); } if (player == null) { return; } if (ll.Equals("Town")) { if (prev.Equals("Casino")) { player.transform.position = new Vector3(3.94f, 1.08f, 0f); } else if (prev.Equals("Home")) { player.transform.position = new Vector3(-3.58f, 0.58f, 0f); } else if (prev.Equals("Office")) { player.transform.position = new Vector3(4.57f, -3.85f, 0f); } else if (prev.Equals("Bank")) { player.transform.position = new Vector3(-1.82f, -2.95f, 0f); } } else if (ll.Equals("Home")) { if (prev.Equals("Town")) { player.transform.position = new Vector3(0.28f, -1.84f, 0f); } else if (prev.Equals("HomeTV")) { player.transform.position = new Vector3(-1.56f, -1.15f, 0); } else if (prev.Equals("Sleep")) { player.transform.position = new Vector3(0.22f, 1.76f, 0); } } else if (ll.Equals("Office")) { //next level is Office if (prev.Equals("Computer")) { player.transform.position = new Vector3(0.745f, 0.95f, 0); } if (prev.Equals("CounsellingCentre")) { player.transform.position = new Vector3(-2.6f, 0.8f, 0); } } else if (ll.Equals("Forest3D") || ll.Equals("Dungeon")) { if (!prev.Equals("Phone")) { GameObject.Find("HealthBar").GetComponent <HealthBar>().show(); GameObject.Find("HealthBar").GetComponent <HealthBar>().reset(); } } else if (ll.Equals("Quest7BossBattle")) { GameObject.Find("HealthBar").GetComponent <HealthBar>().show(); GameObject.Find("HealthBar").GetComponent <HealthBar>().reset(10); } else if (ll.Equals("Casino")) { if (prev.Equals("slotmachine")) { GameObject.FindWithTag("Player").transform.position = SlotMachineColliders.prevPos; } } if (prev.Equals("Phone")) { var pi = GameObject.Find("Phone").GetComponent <PhoneIcon>(); var name = pi.getPrevName(); var pos = pi.getPrevPos(); var g = FindObjectsOfType <GameObject>(); for (var i = 0; i < g.Length; i++) { for (var j = 0; j < name.Count; j++) { if (g[i].gameObject.name.Equals(name[j])) { g[i].transform.position = pos[j]; } } } Debug.Log(player.transform.position.ToString("G4")); } }
// Update is called once per frame private void Update() { if (Input.GetMouseButtonDown(0)) { if (r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { var s = LevelTrack.indexToString(Application.loadedLevel); if (s.Equals("Instructions_1")) { Application.LoadLevel("Instructions_2"); } else if (s.Equals("Instructions_2")) { Application.LoadLevel("Instructions_3"); } else if (s.Equals("Instructions_3")) { Application.LoadLevel("Instructions_4"); } else if (s.Equals("Instructions_4")) { Application.LoadLevel("Instructions_5"); } else if (s.Equals("Instructions_5")) { Application.LoadLevel("Instructions_6"); } else if (s.Equals("Instructions_6")) { Application.LoadLevel("Instructions_7"); } else if (s.Equals("Instructions_7")) { Application.LoadLevel("Instructions_8"); } else if (s.Equals("Instructions_8")) { GameObject.Find("ScreenFader").GetComponent <ScreenFader>().fade(LevelTrack.prevLevel); } else if (s.Equals("EndGame")) { GameObject.Find("WinningNumber").GetComponent <WinningNumber>().reset(); GameObject.Find("Computer").GetComponent <QuestManager>().reset(); MoneyCounter.reset(); DayCounter.reset(); TextBoxBank.reset(); GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>().fade("Menu"); } } } if (!isOver && r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { isOver = true; transform.localScale += new Vector3(0.1f, 0.1f, 0); } if (isOver && !r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) { isOver = false; transform.localScale -= new Vector3(0.1f, 0.1f, 0); } }
// Update is called once per frame private void Update() { //Physics.IgnoreCollision(GetComponent<Collider>(), GameObject.FindWithTag("Player").GetComponent<Collider>()); //var size = GetComponent<Renderer>().bounds.size; //var position = transform.position; var ll = LevelTrack.indexToString(Application.loadedLevel); if (ll.Equals("StartPage") || ll.Equals("Menu") || ll.Equals("Credits") || ll.Equals("Introduction") || ll.Equals("Instructions_1") || ll.Equals("Instructions_2") || ll.Equals("Instructions_3") || ll.Equals("Instructions_4") || ll.Equals("Instructions_5") || ll.Equals("4D") || ll.Equals("CounsellingCentre") || ll.Equals("Sleep") || ll.Equals("EndGame") || ll.Equals("Computer") || ll.Equals("Phone") || ll.Equals("Quest5") || ll.Equals("FailQuest") || ll.Equals("ExitQuest") || ll.Equals("HomeTV") || ll.Equals("CompleteQuest")) { GetComponent <SpriteRenderer>().enabled = false; } else { GetComponent <SpriteRenderer>().enabled = true; } if (Camera.main != null) { if (ll.Equals("Forest3D") || ll.Equals("Dungeon") || ll.Equals("Quest7BossBattle")) { transform.eulerAngles = new Vector3(90, 0, 0); verticalSize = Camera.main.orthographicSize * 2.0f; horizontalSize = verticalSize * Screen.width / Screen.height; transform.position = Vector3.Lerp(transform.position, new Vector3((0.93f * horizontalSize) - horizontalSize / 2 + Camera.main.transform.position.x, 0, (0.39f * verticalSize) - verticalSize / 2 + Camera.main.transform.position.z), 0.1f); //r = new Rect(position.x - size.x/2, position.z - size.y/2, size.x, size.y); } else { transform.eulerAngles = new Vector3(0, 0, 0); verticalSize = Camera.main.orthographicSize * 2.0f; horizontalSize = verticalSize * Screen.width / Screen.height; transform.position = Vector3.Lerp(transform.position, new Vector3((0.93f * horizontalSize) - horizontalSize / 2 + Camera.main.transform.position.x, (0.39f * verticalSize) - verticalSize / 2 + Camera.main.transform.position.y, 0), 0.1f); //r = new Rect(position.x - size.x / 2, position.y - size.y / 2, size.x, size.y); } /*if (Input.GetMouseButtonDown(0) && GetComponent<SpriteRenderer>().enabled) * { * if (r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) * { * prevLoc = GameObject.FindGameObjectWithTag("Player").transform.position; * * Debug.Log(prevLoc.ToString("G4")); * prevLevel = Application.loadedLevel; * GameObject.FindGameObjectWithTag("Fader").GetComponent<ScreenFader>().fade("Phone"); * } * } * if (!isOver && r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) * { * isOver = true; * sr.sprite = mouseOver; * } * if (isOver && !r.Contains(Camera.main.ScreenToWorldPoint(Input.mousePosition))) * { * isOver = false; * sr.sprite = normal; * }*/ } }