void Start () { colorBG = this.transform.Find("Color"); parentCube = this.transform.parent.transform.parent.GetComponent<CubeInteraction>(); targetPosition = this.transform.localPosition; targetScale = Vector3.one; if(position != 1) { targetScale = halfScale; targetPosition = new Vector3(this.transform.localPosition.x,0.5f,this.transform.localPosition.z); } }
void Start() { colorBG = this.transform.Find("Color"); parentCube = this.transform.parent.transform.parent.GetComponent <CubeInteraction>(); targetPosition = this.transform.localPosition; targetScale = Vector3.one; if (position != 1) { targetScale = halfScale; targetPosition = new Vector3(this.transform.localPosition.x, 0.5f, this.transform.localPosition.z); } }
bool VerifIfCube(Vector3 touchPos) { Ray ray = Camera.main.ScreenPointToRay(touchPos); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f)) { if (hit.transform.CompareTag("Cube")) { clickedCube = hit.transform.gameObject.GetComponent <CubeInteraction>(); return(true); } } Debug.Log("cube not clicked"); return(false); }
public override void OnInspectorGUI() { DrawDefaultInspector(); CubeInteraction myScript = (CubeInteraction)target; if (GUILayout.Button("Change Type Right")) { myScript.SwipteType(true); } if (GUILayout.Button("Change Type Left")) { myScript.SwipteType(false); } if (GUILayout.Button("Create WAve")) { myScript.CreateWave(); } }
bool VerifIfCube(Vector3 touchPos) { Ray ray = Camera.main.ScreenPointToRay(touchPos); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f)) { if(hit.transform.CompareTag( "Cube" )) { clickedCube = hit.transform.gameObject.GetComponent<CubeInteraction>(); return true; } } Debug.Log ("cube not clicked"); return false; }