Advertisement
diegographics

Untitled

Apr 5th, 2017
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.17 KB | None | 0 0
  1. //MD5Hash:dd523edd0dc32eedfba09cb22f8d6854;
  2. using UnityEngine;
  3. using System;
  4.  
  5.  
  6. public class GameLogic : UnityEngine.MonoBehaviour
  7. {
  8.     public UnityEngine.Material Material_Black_Icon = null;
  9.     public UnityEngine.Material Material_Black = null;
  10.  
  11.  
  12.     void Start()
  13.     {
  14.     }
  15.     void Update()
  16.     {
  17.     }
  18.     public void Btn_BuildMenu()
  19.     {
  20.         Check_BuildZones(3, 4, false, true);
  21.     }
  22.     public void Check_BuildZones(int X_Index, int Y_Index, bool Elevator, bool Activate_Build_Zone)
  23.     {
  24.         int _One = 1;
  25.         UnityEngine.GameObject _Temp_GameObject_1 = null;
  26.         UnityEngine.GameObject _Temp_GameObject_2 = null;
  27.         UnityEngine.GameObject _Temp_GameObject_3 = null;
  28.         UnityEngine.GameObject _Temp_GameObject_4 = null;
  29.         bool _Active_Build_Zone = false;
  30.  
  31.         _Active_Build_Zone = Activate_Build_Zone;
  32.         if (Elevator)
  33.         {
  34.             ///Find adjacent objects
  35.             _Temp_GameObject_3 = UnityEngine.GameObject.Find("Plane_X_" + X_Index.ToString() + "_Y_" + (Y_Index + _One).ToString() + "(Clone)");
  36.             _Temp_GameObject_4 = UnityEngine.GameObject.Find("Plane_X_" + X_Index.ToString() + "_Y_" + (Y_Index - _One).ToString() + "(Clone)");
  37.             ///Checks if neighbor  objects aviable (=!Null)
  38.             ///Checks if neighbor  objects aviable (=!Null)
  39.             if (_Temp_GameObject_3 == null)
  40.             {
  41.             }
  42.             else
  43.             {
  44.                 ///Get Render Component from Panel Container
  45.                 _Temp_GameObject_3.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>();
  46.                 ///Set or Unset Material
  47.                 if (_Active_Build_Zone)
  48.                 {
  49.                     ///Set or Unset Material
  50.                     _Temp_GameObject_3.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black_Icon;
  51.                 }
  52.                 else
  53.                 {
  54.                     ///Set or Unset Material
  55.                     _Temp_GameObject_3.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black;
  56.                 }
  57.  
  58.             }
  59.  
  60.             ///Checks if neighbor  objects aviable (=!Null)
  61.             if (_Temp_GameObject_4 == null)
  62.             {
  63.             }
  64.             else
  65.             {
  66.                 ///Get Render Component from Panel Container
  67.                 _Temp_GameObject_4.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>();
  68.                 ///Set or Unset Material
  69.                 if (_Active_Build_Zone)
  70.                 {
  71.                     ///Set or Unset Material
  72.                     _Temp_GameObject_4.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black_Icon;
  73.                 }
  74.                 else
  75.                 {
  76.                     ///Set or Unset Material
  77.                     _Temp_GameObject_4.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black;
  78.                 }
  79.  
  80.             }
  81.  
  82.         }
  83.         else
  84.         {
  85.             ///Find adjacent objects
  86.             _Temp_GameObject_2 = UnityEngine.GameObject.Find("Plane_X_" + (X_Index - _One).ToString() + "_Y_" + Y_Index.ToString() + "(Clone)");
  87.             _Temp_GameObject_1 = UnityEngine.GameObject.Find("Plane_X_" + (X_Index + _One).ToString() + "_Y_" + Y_Index.ToString() + "(Clone)");
  88.             ///Checks if neighbor  objects aviable (=!Null)
  89.             ///Checks if neighbor  objects aviable (=!Null)
  90.             if (_Temp_GameObject_1 == null)
  91.             {
  92.             }
  93.             else
  94.             {
  95.                 ///Get Render Component from Panel Container
  96.                 _Temp_GameObject_1.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>();
  97.                 ///Set or Unset Material
  98.                 if (_Active_Build_Zone)
  99.                 {
  100.                     ///Set or Unset Material
  101.                     _Temp_GameObject_1.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black_Icon;
  102.                 }
  103.                 else
  104.                 {
  105.                     ///Set or Unset Material
  106.                     _Temp_GameObject_1.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black;
  107.                 }
  108.  
  109.             }
  110.  
  111.             ///Checks if neighbor  objects aviable (=!Null)
  112.             if (_Temp_GameObject_2 == null)
  113.             {
  114.             }
  115.             else
  116.             {
  117.                 ///Get Render Component from Panel Container
  118.                 _Temp_GameObject_2.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>();
  119.                 ///Set or Unset Material
  120.                 if (_Active_Build_Zone)
  121.                 {
  122.                     ///Set or Unset Material
  123.                     _Temp_GameObject_2.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black_Icon;
  124.                 }
  125.                 else
  126.                 {
  127.                     ///Set or Unset Material
  128.                     _Temp_GameObject_2.transform.GetChild(0).gameObject.GetComponent<UnityEngine.Renderer>().material = Material_Black;
  129.                 }
  130.  
  131.             }
  132.  
  133.         }
  134.  
  135.     }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement