Advertisement
PanMichal

Untitled

Mar 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.41 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class zmianapter : MonoBehaviour
  6. {
  7.     public Material greenMaterial;
  8.     public Material grayMaterial;
  9.     public GameObject parter;
  10.     public GameObject pierwsze;
  11.     public GameObject drugie;
  12.     public string t;
  13.     public int pt;
  14.  
  15.     public GameObject nv_0;
  16.     public GameObject nv_1;
  17.     public GameObject nv_2;
  18.     //public GameObject nv_3;
  19.     private GameObject[] navpart;
  20.     private GameObject[] navp1;
  21.     private GameObject[] navpl2;
  22.     public GameObject schody;
  23.     private Vector3 pos0;
  24.     private Vector3 pos1;
  25.     private Vector3 pos2;
  26.     void Start()
  27.     {
  28.         parter.SetActive(true);
  29.         pierwsze.SetActive(false); //parter
  30.         drugie.SetActive(false);
  31.         pt = 0; //parter
  32.         //
  33.         //navpart = GameObject.FindGameObjectsWithTag("parter");
  34.         //navp1 = GameObject.FindGameObjectsWithTag("1 pt");
  35.         //navpl2 = GameObject.FindGameObjectsWithTag("2 pt");
  36.  
  37.  
  38.  
  39.         //foreach (GameObject n in navp1)
  40.         //{
  41.         //    pos0 = n.transform.position;
  42.         //    n.transform.position = schody.transform.position;
  43.         //}
  44.         //foreach (GameObject n in navpart)
  45.         //{
  46.         //    pos1 = n.transform.position;
  47.            
  48.         //}
  49.         //foreach (GameObject n in navpl2)
  50.         //{
  51.         //    pos2 = n.transform.position;
  52.         //}
  53.  
  54.         //foreach (GameObject n in navpl2)
  55.         //{
  56.         //    n.transform.position = schody.transform.position;
  57.         //}
  58.     }
  59.  
  60.     // Update is called once per frame
  61.     void Update()
  62.     {
  63.         //if (pt == 0)
  64.         //{
  65.         //    nv_1.SetActive(false);
  66.         //    nv_2.SetActive(false);
  67.         //    nv_0.SetActive(true);
  68.  
  69.         //}
  70.         //else if (pt == 1)
  71.         //{
  72.         //    nv_1.SetActive(true);
  73.         //    nv_2.SetActive(false);
  74.         //    nv_0.SetActive(false);
  75.         //}
  76.         //else if (pt == 2)
  77.         //{
  78.         //    nv_1.SetActive(false);
  79.         //    nv_2.SetActive(true);
  80.         //    nv_0.SetActive(false);
  81.         //}
  82.  
  83.         //if (pt == 0)
  84.         //{
  85.            
  86.         //    foreach (GameObject s in GameObject.FindGameObjectsWithTag("prt") )
  87.         //    {
  88.         //        s.SetActive(false);
  89.         //    }
  90.            
  91.         //}
  92.         //else if (pt == 1)
  93.         //{
  94.         //    foreach (GameObject s in GameObject.FindGameObjectsWithTag("1sze"))
  95.         //    {
  96.         //        s.SetActive(false);
  97.         //    }
  98.         //}
  99.         //else if (pt == 2)
  100.         //{
  101.         //    foreach (GameObject s in GameObject.FindGameObjectsWithTag("2gie"))
  102.         //    {
  103.         //        s.SetActive(false);
  104.         //    }
  105.  
  106.         //}
  107.  
  108.     }
  109.  
  110.     public void Strepsils(string nw)
  111.     {
  112.        
  113.        if (nw == parter.name)
  114.          {
  115.                 parter.SetActive(true);
  116.                 pierwsze.SetActive(false);
  117.                 drugie.SetActive(false);
  118.          }
  119.          else if (nw == pierwsze.name)
  120.          {
  121.                 parter.SetActive(false);
  122.                 pierwsze.SetActive(true);
  123.                 drugie.SetActive(false);
  124.          }
  125.          else if (nw == drugie.name)
  126.          {
  127.                 parter.SetActive(false);
  128.                 pierwsze.SetActive(false);
  129.                 drugie.SetActive(true);
  130.          }
  131.        
  132.     }
  133.     public void Strepsilsnr(int ptnr)
  134.     {
  135.         pt = ptnr;
  136.         schody.GetComponent<Renderer> ().material = grayMaterial;
  137.         if (pt == 0)
  138.             parter.transform.GetChild(0).GetComponent<Renderer> ().material = greenMaterial;
  139.         if (pt == 1)
  140.             pierwsze.transform.GetChild (0).GetComponent<Renderer> ().material = greenMaterial;
  141.         if (pt == 2)
  142.             drugie.transform.GetChild (0).GetComponent<Renderer> ().material = greenMaterial;
  143.         //    if (pt == 0)
  144.         //    {
  145.         //        foreach (GameObject n in navpart)
  146.         //        {
  147.         //            n.transform.position = pos0;
  148.         //        }
  149.         //        foreach(GameObject n in navp1)
  150.         //        {
  151.         //            n.transform.position = schody.transform.position;
  152.         //        }
  153.         //        foreach (GameObject n in navpl2)
  154.         //        {
  155.         //            n.transform.position = schody.transform.position;
  156.         //        }
  157.         //    }
  158.         //    if (pt == 1)
  159.         //    {
  160.         //        foreach (GameObject n in navpart)
  161.         //        {
  162.         //            n.transform.position = schody.transform.position;
  163.         //        }
  164.         //        foreach (GameObject n in navp1)
  165.         //        {
  166.         //            n.transform.position = pos2;
  167.         //        }
  168.         //        foreach (GameObject n in navpl2)
  169.         //        {
  170.         //            n.transform.position = schody.transform.position;
  171.         //        }
  172.         //    }
  173.         //    if (pt == 2)
  174.         //    {
  175.         //        foreach (GameObject n in navpl2)
  176.         //        {
  177.         //            n.transform.position = pos2;
  178.         //        }
  179.         //        foreach (GameObject n in navpart)
  180.         //        {
  181.         //            n.transform.position = schody.transform.position;
  182.         //        }
  183.         //        foreach (GameObject n in navp1)
  184.         //        {
  185.         //            n.transform.position = schody.transform.position;
  186.         //        }
  187.         //    }
  188.     }
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement