Advertisement
PanMichal

Untitled

Mar 24th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.57 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.AI;
  5. using UnityEngine.UI;
  6. using System.Net;
  7.  
  8.  
  9. public class navi : MonoBehaviour
  10. {
  11.     public NavMeshAgent nav;
  12.     public Text cel;
  13.     private GameObject cel_obj;
  14.     private string cel_nw;
  15.     public NavMeshPath meshPath;
  16.     public GameObject navigator;
  17.     public GameObject cursor;
  18.     private GameObject[] placeholdery;
  19.     public string destination;
  20.     public Sprite dr_persp;
  21.     public Sprite trz_persp;
  22.     public Image Viev;
  23.     public GameObject Menu;
  24.     [SerializeField] private Animator menuAnimator;
  25.     public GameObject debug_13;
  26.     //
  27.     private string[] t0a = { "pielęgniarka", "lekarz", "pomoc" };
  28.     private string[] t0b = { "pedagog", "przypał" };
  29.     private string[] t0c = { "przypał" };
  30.     private string[] t14 = { "14", "sala 14" };
  31.     private string[] t13 = { "13", "sala 13" };
  32.     private string[] t12 = { "12", "sala 12" };
  33.     private string[] t11 = { "11", "sala 11" };
  34.     private string[] t15 = { "15", "sala 15" };
  35.     private string[] tw0 = { "wc", "toaleta", "łazienka" };
  36.     private string[] t0d = { "nauczyciel", "gabinet nauczyciela" };
  37.     private string[] t0e = { "portiernia" };
  38.     private string[] ts = { "16", "świetlica" };
  39.     private string[] tc = { "czytelnia" };
  40.     private string[] tsc = { "socialny" };
  41.     private string[] tb = { "biblioteka" };
  42.     //gimnasstyczna
  43.     private string[] tgw = { "gabinet wf", "wf" };
  44.     private string[]= { "łazienka" };
  45.     private string[] tts = { "szatnia" };
  46.     //1 pt
  47.     private string[] t38 = { "38", "sala 38" };
  48.     private string[] t39 = { "39", "sala 39" };
  49.     private string[] t40 = { "40", "sala 40" };
  50.     private string[] t41 = { "41", "sala 41" };
  51.     private string[] t42 = { "42", "sala 42" };
  52.     private string[] t43 = { "43", "sala 43" };
  53.     private string[] ttw0 = { "wc", "toaleta", "łazienka" };
  54.     private string[] t1a = { "nauczyciel", "gabinet nauczyciela" };
  55.     private string[] t1b = { "kierownik", "tv" };
  56.     private string[] tpi = { "pokój informatyka", "informatyk" };
  57.     private string[] t1c = { "nauczyciel", "gabinet nauczyciela" };
  58.     private string[] t1d = { "pomieszczenie biórowe" };
  59.     private string[] tdr = { "dyrektor" };
  60.     private string[] tdyr = { "wicedyrektor" };
  61.     private string[] tpb = { "biuro" };
  62.     private string[] tps = { "socialne" };
  63.     private string[] tks = { "księgowość" };
  64.     private string[] tsk = { "sekretariat" };
  65.     //2 pt
  66.     private string[] t44 = { "44", "sala 44" };
  67.     private string[] t45 = { "45", "sala 45" };
  68.     private string[] t46 = { "46", "sala 46" };
  69.     private string[] t47 = { "47", "sala 47" };
  70.     private string[] t48 = { "48", "sala 48" };
  71.     private string[] t50 = { "50", "sala 50" };
  72.     private string[] t51 = { "51", "sala 51" };
  73.     private string[] t52 = { "52", "sala 52" };
  74.     private string[] tmg = { "magazyn", "kantorek" };
  75.     private string[] tmk = { "mieszkanie" };
  76.     private string[] t2a = { "nauczyciel", "gabinet nauczyciela" };
  77.     private string[] tttw0 = { "wc", "toaleta", "łazienka" };
  78.     public bool dziala;
  79.     public Text zegar;
  80.     private string przenośnia;
  81.  
  82.     public void OpenMenu () {
  83.         menuAnimator.SetBool ("Open", !menuAnimator.GetBool("Open"));
  84.     }
  85.  
  86.     void Start()
  87.     {
  88.         navigator.transform.position = cursor.transform.position;
  89.        
  90.     }
  91.  
  92.     // Update is called once per frame
  93.     void Update()
  94.     {
  95.         //krzyśka żyroskop bo mie prosił
  96.         cursor.transform.rotation = Quaternion.Euler(0, -Input.compass.trueHeading, 0);
  97.         //błagał wręcz
  98.         //na kolanach
  99.         //XD
  100.  
  101.  
  102.         //if (nav.remainingDistance < 0.1)
  103.         //{
  104.         //    nav.transform.position = cursor.transform.position;
  105.         //}
  106.         zegar.text = System.DateTime.Now.Hour.ToString() + ":" + przenośnia + System.DateTime.Now.Minute.ToString();
  107.         if (System.DateTime.Now.Minute < 10)
  108.         {
  109.             przenośnia = "0";
  110.         }
  111.         else
  112.         {
  113.             przenośnia = "";
  114.         }
  115.     }
  116.     public void Navigate()
  117.     {
  118.        
  119.         navigator.transform.position = cursor.transform.position;
  120.         cel_nw = cel.text;
  121.         // multi search engine witka :3
  122.         foreach (string s in t0a)
  123.         {
  124.             if (cel.text == s)
  125.             {
  126.                 cel_obj = GameObject.Find("0a");
  127.                 dziala = true;
  128.             }
  129.         }
  130.         foreach (string s in t0b)
  131.         {
  132.             if (cel.text == s)
  133.             {
  134.                 cel_obj = GameObject.Find("0b");
  135.                 dziala = true;
  136.             }
  137.         }
  138.         foreach (string s in t0c)
  139.         {
  140.             if (cel.text == s)
  141.             {
  142.                 cel_obj = GameObject.Find("0c");
  143.                 dziala = true;
  144.             }
  145.         }
  146.         foreach (string s in t14)
  147.         {
  148.             if (cel.text == s)
  149.             {
  150.                 cel_obj = GameObject.Find("14");
  151.                 dziala = true;
  152.             }
  153.         }
  154.         foreach (string s in t13)
  155.         {
  156.             if (cel.text == s)
  157.             {
  158.                 cel_obj = GameObject.Find("13");
  159.                 dziala = true;
  160.             }
  161.         }
  162.         foreach (string s in t12)
  163.         {
  164.             if (cel.text == s)
  165.             {
  166.                 cel_obj = GameObject.Find("12");
  167.                 dziala = true;
  168.             }
  169.         }
  170.         foreach (string s in t11)
  171.         {
  172.             if (cel.text == s)
  173.             {
  174.                 cel_obj = GameObject.Find("11");
  175.                 dziala = true;
  176.             }
  177.         }
  178.         foreach (string s in t15)
  179.         {
  180.             if (cel.text == s)
  181.             {
  182.                 cel_obj = GameObject.Find("15");
  183.                 dziala = true;
  184.             }
  185.         }
  186.         foreach (string s in tw0)
  187.         {
  188.             if (cel.text == s)
  189.             {
  190.                 cel_obj = GameObject.Find("w0");
  191.                 dziala = true;
  192.             }
  193.         }
  194.         foreach (string s in t0d)
  195.         {
  196.             if (cel.text == s)
  197.             {
  198.                 cel_obj = GameObject.Find("0d");
  199.                 dziala = true;
  200.             }
  201.         }
  202.         foreach (string s in t0e)
  203.         {
  204.             if (cel.text == s)
  205.             {
  206.                 cel_obj = GameObject.Find("0e");
  207.                 dziala = true;
  208.             }
  209.         }
  210.         foreach (string s in ts)
  211.         {
  212.             if (cel.text == s)
  213.             {
  214.                 cel_obj = GameObject.Find("s");
  215.                 dziala = true;
  216.             }
  217.         }
  218.         foreach (string s in tc)
  219.         {
  220.             if (cel.text == s)
  221.             {
  222.                 cel_obj = GameObject.Find("c");
  223.                 dziala = true;
  224.             }
  225.         }
  226.         foreach (string s in tsc)
  227.         {
  228.             if (cel.text == s)
  229.             {
  230.                 cel_obj = GameObject.Find("sc");
  231.                 dziala = true;
  232.             }
  233.         }
  234.         foreach (string s in tb)
  235.         {
  236.             if (cel.text == s)
  237.             {
  238.                 cel_obj = GameObject.Find("b");
  239.                 dziala = true;
  240.             }
  241.         }
  242.         foreach (string s in tgw)
  243.         {
  244.             if (cel.text == s)
  245.             {
  246.                 cel_obj = GameObject.Find("gw");
  247.                 dziala = true;
  248.             }
  249.         }
  250.         foreach (string s in)
  251.         {
  252.             if (cel.text == s)
  253.             {
  254.                 cel_obj = GameObject.Find("ł");
  255.                 dziala = true;
  256.             }
  257.         }
  258.         foreach (string s in tts)
  259.         {
  260.             if (cel.text == s)
  261.             {
  262.                 cel_obj = GameObject.Find("ts");
  263.                 dziala = true;
  264.             }
  265.         }
  266.         foreach (string s in t38)
  267.         {
  268.             if (cel.text == s)
  269.             {
  270.                 cel_obj = GameObject.Find("38");
  271.                 dziala = true;
  272.             }
  273.         }
  274.         foreach (string s in t39)
  275.         {
  276.             if (cel.text == s)
  277.             {
  278.                 cel_obj = GameObject.Find("39");
  279.                 dziala = true;
  280.             }
  281.         }
  282.         foreach (string s in t40)
  283.         {
  284.             if (cel.text == s)
  285.             {
  286.                 cel_obj = GameObject.Find("40");
  287.                 dziala = true;
  288.             }
  289.         }
  290.         foreach (string s in t41)
  291.         {
  292.             if (cel.text == s)
  293.             {
  294.                 cel_obj = GameObject.Find("41");
  295.                 dziala = true;
  296.             }
  297.         }
  298.         foreach (string s in t42)
  299.         {
  300.             if (cel.text == s)
  301.             {
  302.                 cel_obj = GameObject.Find("42");
  303.                 dziala = true;
  304.             }
  305.         }
  306.         foreach (string s in t43)
  307.         {
  308.             if (cel.text == s)
  309.             {
  310.                 cel_obj = GameObject.Find("43");
  311.                 dziala = true;
  312.             }
  313.         }
  314.         foreach (string s in ttw0)
  315.         {
  316.             if (cel.text == s)
  317.             {
  318.                 cel_obj = GameObject.Find("tw0");
  319.                 dziala = true;
  320.             }
  321.         }
  322.         foreach (string s in t1a)
  323.         {
  324.             if (cel.text == s)
  325.             {
  326.                 cel_obj = GameObject.Find("1a");
  327.                 dziala = true;
  328.             }
  329.         }
  330.         foreach (string s in t1b)
  331.         {
  332.             if (cel.text == s)
  333.             {
  334.                 cel_obj = GameObject.Find("1b");
  335.                 dziala = true;
  336.             }
  337.         }
  338.         foreach (string s in tpi)
  339.         {
  340.             if (cel.text == s)
  341.             {
  342.                 cel_obj = GameObject.Find("pi");
  343.                 dziala = true;
  344.             }
  345.         }
  346.         foreach (string s in t1c)
  347.         {
  348.             if (cel.text == s)
  349.             {
  350.                 cel_obj = GameObject.Find("1c");
  351.                 dziala = true;
  352.             }
  353.         }
  354.         foreach (string s in t1d)
  355.         {
  356.             if (cel.text == s)
  357.             {
  358.                 cel_obj = GameObject.Find("1d");
  359.                 dziala = true;
  360.             }
  361.         }
  362.         foreach (string s in tdr)
  363.         {
  364.             if (cel.text == s)
  365.             {
  366.                 cel_obj = GameObject.Find("dr");
  367.                 dziala = true;
  368.             }
  369.         }
  370.         foreach (string s in tdyr)
  371.         {
  372.             if (cel.text == s)
  373.             {
  374.                 cel_obj = GameObject.Find("dyr");
  375.                 dziala = true;
  376.             }
  377.         }
  378.         foreach (string s in tpb)
  379.         {
  380.             if (cel.text == s)
  381.             {
  382.                 cel_obj = GameObject.Find("pb");
  383.                 dziala = true;
  384.             }
  385.         }
  386.         foreach (string s in tps)
  387.         {
  388.             if (cel.text == s)
  389.             {
  390.                 cel_obj = GameObject.Find("ps");
  391.                 dziala = true;
  392.             }
  393.         }
  394.         foreach (string s in tks)
  395.         {
  396.             if (cel.text == s)
  397.             {
  398.                 cel_obj = GameObject.Find("ks");
  399.                 dziala = true;
  400.             }
  401.         }
  402.         foreach (string s in t44)
  403.         {
  404.             if (cel.text == s)
  405.             {
  406.                 cel_obj = GameObject.Find("44");
  407.                 dziala = true;
  408.             }
  409.         }
  410.         foreach (string s in t45)
  411.         {
  412.             if (cel.text == s)
  413.             {
  414.                 cel_obj = GameObject.Find("45");
  415.                 dziala = true;
  416.             }
  417.         }
  418.         foreach (string s in t46)
  419.         {
  420.             if (cel.text == s)
  421.             {
  422.                 cel_obj = GameObject.Find("46");
  423.                 dziala = true;
  424.             }
  425.         }
  426.         foreach (string s in t47)
  427.         {
  428.             if (cel.text == s)
  429.             {
  430.                 cel_obj = GameObject.Find("47");
  431.                 dziala = true;
  432.             }
  433.         }
  434.         foreach (string s in t48)
  435.         {
  436.             if (cel.text == s)
  437.             {
  438.                 cel_obj = GameObject.Find("48");
  439.                 dziala = true;
  440.             }
  441.         }
  442.         foreach (string s in t50)
  443.         {
  444.             if (cel.text == s)
  445.             {
  446.                 cel_obj = GameObject.Find("50");
  447.                 dziala = true;
  448.             }
  449.         }
  450.         foreach (string s in t51)
  451.         {
  452.             if (cel.text == s)
  453.             {
  454.                 cel_obj = GameObject.Find("51");
  455.                 dziala = true;
  456.             }
  457.         }
  458.         foreach (string s in t52)
  459.         {
  460.             if (cel.text == s)
  461.             {
  462.                 cel_obj = GameObject.Find("52");
  463.                 dziala = true;
  464.             }
  465.         }
  466.         foreach (string s in tmg)
  467.         {
  468.             if (cel.text == s)
  469.             {
  470.                 cel_obj = GameObject.Find("mg");
  471.                 dziala = true;
  472.             }
  473.         }
  474.         foreach (string s in tmk)
  475.         {
  476.             if (cel.text == s)
  477.             {
  478.                 cel_obj = GameObject.Find("mk");
  479.                 dziala = true;
  480.             }
  481.         }
  482.         foreach (string s in t2a)
  483.         {
  484.             if (cel.text == s)
  485.             {
  486.                 cel_obj = GameObject.Find("2a");
  487.                 dziala = true;
  488.             }
  489.         }
  490.         foreach (string s in tttw0)
  491.         {
  492.             if (cel.text == s)
  493.             {
  494.                 cel_obj = GameObject.Find("w2");
  495.                 dziala = true;
  496.             }
  497.         }
  498.         if (cel_obj != null) {
  499.             if (cel_obj.activeInHierarchy == false)                        //jeśli nie jest aktywny
  500.             {
  501.                 cel_obj = GameObject.Find ("SCH1ODY");           //idzie do schodów :3
  502.             }
  503.         }
  504.         //
  505.         //cel_obj = GameObject.Find(cel_nw);
  506.         nav.SetDestination(cel_obj.transform.position);
  507.         //nav.Warp(cel_obj.transform.position);
  508.         //nav.SetDestination(debug_13.transform.position);
  509.     }
  510.  
  511.     //public void Navigate (string t) {
  512.     //  var temp = cel.text;
  513.     //  cel.text = t;
  514.     //  Navigate ();
  515.     //  cel.text = temp;
  516.     //}
  517.  
  518.     public void zmianaprp()
  519.     {
  520.  
  521.         if (Viev.sprite == dr_persp)
  522.         {
  523.             Camera.main.orthographic = true;
  524.             Viev.sprite = trz_persp;
  525.         }
  526.         else if (Viev.sprite == trz_persp)
  527.         {
  528.             Camera.main.orthographic = false;
  529.             Viev.sprite = dr_persp;
  530.         }
  531.     }
  532.  
  533.     public void info()
  534.     {
  535.        
  536.     }
  537.     public void navZmien()
  538.     {
  539.  
  540.         nav.SetDestination(GameObject.Find("14").transform.position);
  541.         OpenMenu();
  542.     }
  543.  
  544. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement