예제 #1
0
	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);
		}
	}
예제 #2
0
 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);
     }
 }
예제 #3
0
    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);
    }
예제 #4
0
    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();
        }
    }
예제 #5
0
	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;

	}