protected void Start() { if (MyId == null) { return; } base.Start(); PlaneGeometry.GetComponent <Renderer>().sharedMaterial = _material; //This is when the Plane is called from the loading fuction if (_scale != new Vector3() && _scale != null) { _planeGeometry.transform.SetParent(null); _planeGeometry.transform.position = transform.position; _planeGeometry.transform.localScale = _scale; //it will work it if is initiated with a scale if (!_isAnInVisiblePlane) { _planeGeometry.GetComponent <Renderer>().enabled = true; } _planeGeometry.transform.SetParent(transform); InitializeMatColors(); } DetermineTileImAndSmartStart(); }
/// <summary> /// Check what is current color if is initial color or red and with condition will /// switch current game obj color /// </summary> /// <param name="condition">condition true = initial_color, condition false = red</param> public void CheckAndSwitchColor(bool condition) { if (PlaneGeometry.GetComponent <Renderer>().material.color == InitialColor && !condition) { PlaneGeometry.GetComponent <Renderer>().material.color = Color.red; } else if (PlaneGeometry.GetComponent <Renderer>().material.color == Color.red && condition) { PlaneGeometry.GetComponent <Renderer>().material.color = InitialColor; } if (BuildingPot.Control == null) { return; } if (BuildingPot.Control.CurrentSpawnBuild == null) { return; } if (BuildingPot.Control.CurrentSpawnBuild.Projector == null) { return; } BuildingPot.Control.CurrentSpawnBuild.Projector.SwitchColorLight(condition); }