Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.AI;
- using UnityEngine.UI;
- using System.Net;
- public class navi : MonoBehaviour
- {
- public NavMeshAgent nav;
- public Text cel;
- private GameObject cel_obj;
- private string cel_nw;
- public NavMeshPath meshPath;
- public GameObject navigator;
- public GameObject cursor;
- private GameObject[] placeholdery;
- public string destination;
- public Sprite dr_persp;
- public Sprite trz_persp;
- public Image Viev;
- public GameObject Menu;
- [SerializeField] private Animator menuAnimator;
- public GameObject debug_13;
- //
- private string[] t0a = { "pielęgniarka", "lekarz", "pomoc" };
- private string[] t0b = { "pedagog", "przypał" };
- private string[] t0c = { "przypał" };
- private string[] t14 = { "14", "sala 14" };
- private string[] t13 = { "13", "sala 13" };
- private string[] t12 = { "12", "sala 12" };
- private string[] t11 = { "11", "sala 11" };
- private string[] t15 = { "15", "sala 15" };
- private string[] tw0 = { "wc", "toaleta", "łazienka" };
- private string[] t0d = { "nauczyciel", "gabinet nauczyciela" };
- private string[] t0e = { "portiernia" };
- private string[] ts = { "16", "świetlica" };
- private string[] tc = { "czytelnia" };
- private string[] tsc = { "socialny" };
- private string[] tb = { "biblioteka" };
- //gimnasstyczna
- private string[] tgw = { "gabinet wf", "wf" };
- private string[] tł = { "łazienka" };
- private string[] tts = { "szatnia" };
- //1 pt
- private string[] t38 = { "38", "sala 38" };
- private string[] t39 = { "39", "sala 39" };
- private string[] t40 = { "40", "sala 40" };
- private string[] t41 = { "41", "sala 41" };
- private string[] t42 = { "42", "sala 42" };
- private string[] t43 = { "43", "sala 43" };
- private string[] ttw0 = { "wc", "toaleta", "łazienka" };
- private string[] t1a = { "nauczyciel", "gabinet nauczyciela" };
- private string[] t1b = { "kierownik", "tv" };
- private string[] tpi = { "pokój informatyka", "informatyk" };
- private string[] t1c = { "nauczyciel", "gabinet nauczyciela" };
- private string[] t1d = { "pomieszczenie biórowe" };
- private string[] tdr = { "dyrektor" };
- private string[] tdyr = { "wicedyrektor" };
- private string[] tpb = { "biuro" };
- private string[] tps = { "socialne" };
- private string[] tks = { "księgowość" };
- private string[] tsk = { "sekretariat" };
- //2 pt
- private string[] t44 = { "44", "sala 44" };
- private string[] t45 = { "45", "sala 45" };
- private string[] t46 = { "46", "sala 46" };
- private string[] t47 = { "47", "sala 47" };
- private string[] t48 = { "48", "sala 48" };
- private string[] t50 = { "50", "sala 50" };
- private string[] t51 = { "51", "sala 51" };
- private string[] t52 = { "52", "sala 52" };
- private string[] tmg = { "magazyn", "kantorek" };
- private string[] tmk = { "mieszkanie" };
- private string[] t2a = { "nauczyciel", "gabinet nauczyciela" };
- private string[] tttw0 = { "wc", "toaleta", "łazienka" };
- public bool dziala;
- public Text zegar;
- private string przenośnia;
- public void OpenMenu () {
- menuAnimator.SetBool ("Open", !menuAnimator.GetBool("Open"));
- }
- void Start()
- {
- navigator.transform.position = cursor.transform.position;
- }
- // Update is called once per frame
- void Update()
- {
- //krzyśka żyroskop bo mie prosił
- cursor.transform.rotation = Quaternion.Euler(0, -Input.compass.trueHeading, 0);
- //błagał wręcz
- //na kolanach
- //XD
- //if (nav.remainingDistance < 0.1)
- //{
- // nav.transform.position = cursor.transform.position;
- //}
- zegar.text = System.DateTime.Now.Hour.ToString() + ":" + przenośnia + System.DateTime.Now.Minute.ToString();
- if (System.DateTime.Now.Minute < 10)
- {
- przenośnia = "0";
- }
- else
- {
- przenośnia = "";
- }
- }
- public void Navigate()
- {
- navigator.transform.position = cursor.transform.position;
- cel_nw = cel.text;
- // multi search engine witka :3
- foreach (string s in t0a)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("0a");
- dziala = true;
- }
- }
- foreach (string s in t0b)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("0b");
- dziala = true;
- }
- }
- foreach (string s in t0c)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("0c");
- dziala = true;
- }
- }
- foreach (string s in t14)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("14");
- dziala = true;
- }
- }
- foreach (string s in t13)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("13");
- dziala = true;
- }
- }
- foreach (string s in t12)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("12");
- dziala = true;
- }
- }
- foreach (string s in t11)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("11");
- dziala = true;
- }
- }
- foreach (string s in t15)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("15");
- dziala = true;
- }
- }
- foreach (string s in tw0)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("w0");
- dziala = true;
- }
- }
- foreach (string s in t0d)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("0d");
- dziala = true;
- }
- }
- foreach (string s in t0e)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("0e");
- dziala = true;
- }
- }
- foreach (string s in ts)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("s");
- dziala = true;
- }
- }
- foreach (string s in tc)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("c");
- dziala = true;
- }
- }
- foreach (string s in tsc)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("sc");
- dziala = true;
- }
- }
- foreach (string s in tb)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("b");
- dziala = true;
- }
- }
- foreach (string s in tgw)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("gw");
- dziala = true;
- }
- }
- foreach (string s in tł)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("ł");
- dziala = true;
- }
- }
- foreach (string s in tts)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("ts");
- dziala = true;
- }
- }
- foreach (string s in t38)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("38");
- dziala = true;
- }
- }
- foreach (string s in t39)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("39");
- dziala = true;
- }
- }
- foreach (string s in t40)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("40");
- dziala = true;
- }
- }
- foreach (string s in t41)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("41");
- dziala = true;
- }
- }
- foreach (string s in t42)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("42");
- dziala = true;
- }
- }
- foreach (string s in t43)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("43");
- dziala = true;
- }
- }
- foreach (string s in ttw0)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("tw0");
- dziala = true;
- }
- }
- foreach (string s in t1a)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("1a");
- dziala = true;
- }
- }
- foreach (string s in t1b)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("1b");
- dziala = true;
- }
- }
- foreach (string s in tpi)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("pi");
- dziala = true;
- }
- }
- foreach (string s in t1c)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("1c");
- dziala = true;
- }
- }
- foreach (string s in t1d)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("1d");
- dziala = true;
- }
- }
- foreach (string s in tdr)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("dr");
- dziala = true;
- }
- }
- foreach (string s in tdyr)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("dyr");
- dziala = true;
- }
- }
- foreach (string s in tpb)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("pb");
- dziala = true;
- }
- }
- foreach (string s in tps)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("ps");
- dziala = true;
- }
- }
- foreach (string s in tks)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("ks");
- dziala = true;
- }
- }
- foreach (string s in t44)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("44");
- dziala = true;
- }
- }
- foreach (string s in t45)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("45");
- dziala = true;
- }
- }
- foreach (string s in t46)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("46");
- dziala = true;
- }
- }
- foreach (string s in t47)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("47");
- dziala = true;
- }
- }
- foreach (string s in t48)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("48");
- dziala = true;
- }
- }
- foreach (string s in t50)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("50");
- dziala = true;
- }
- }
- foreach (string s in t51)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("51");
- dziala = true;
- }
- }
- foreach (string s in t52)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("52");
- dziala = true;
- }
- }
- foreach (string s in tmg)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("mg");
- dziala = true;
- }
- }
- foreach (string s in tmk)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("mk");
- dziala = true;
- }
- }
- foreach (string s in t2a)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("2a");
- dziala = true;
- }
- }
- foreach (string s in tttw0)
- {
- if (cel.text == s)
- {
- cel_obj = GameObject.Find("w2");
- dziala = true;
- }
- }
- if (cel_obj != null) {
- if (cel_obj.activeInHierarchy == false) //jeśli nie jest aktywny
- {
- cel_obj = GameObject.Find ("SCH1ODY"); //idzie do schodów :3
- }
- }
- //
- //cel_obj = GameObject.Find(cel_nw);
- nav.SetDestination(cel_obj.transform.position);
- //nav.Warp(cel_obj.transform.position);
- //nav.SetDestination(debug_13.transform.position);
- }
- //public void Navigate (string t) {
- // var temp = cel.text;
- // cel.text = t;
- // Navigate ();
- // cel.text = temp;
- //}
- public void zmianaprp()
- {
- if (Viev.sprite == dr_persp)
- {
- Camera.main.orthographic = true;
- Viev.sprite = trz_persp;
- }
- else if (Viev.sprite == trz_persp)
- {
- Camera.main.orthographic = false;
- Viev.sprite = dr_persp;
- }
- }
- public void info()
- {
- }
- public void navZmien()
- {
- nav.SetDestination(GameObject.Find("14").transform.position);
- OpenMenu();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement