예제 #1
0
    void UpdateCube(BoxParameters box)
    {
        Vector3 size = new Vector3(box.width, box.height, box.depth);

        gameObject.transform.localScale = size;
        gameObject.GetComponent <Renderer>().material.color = box.color;
    }
예제 #2
0
 //Update is called once per frame
 void Update()
 {
     Vector3 cuboPos = GameObject.Find ("Cubo").transform.position;
     ThatBox =
         GameObject.Find("Box1").GetComponent<Struct>().myParameters;
     gameObject.transform.position =
         new Vector3(cuboPos.x,ThatBox.height*0.5f, cuboPos.z);
 }
    public void Load(SaveType _saveType)
    {
        switch (_saveType)
        {
        case SaveType.Local:
            boxParameters = saveManager.LoadFromFile("BoxParameters", new BoxParameters());

            Debug.Log("Local: Loaded UserPrefs data = " + boxParameters.depth);
            break;

        case SaveType.UserPrefs:
            string boxData = PlayerPrefs.GetString("boxData");
            boxParameters = JsonUtility.FromJson <BoxParameters> (boxData);

            Debug.Log("UserPrefs: Loaded UserPrefsData = " + boxParameters.height);
            break;
        }
    }
    public void Save(SaveType _saveType, BoxParameters _boxParameters)
    {
        switch (_saveType)
        {
        case SaveType.Local:
            saveManager.SaveToFile(boxParameters, "BoxParameters");

            Debug.Log("Local: Saved UserPrefs data = " + boxParameters.depth);
            break;

        case SaveType.UserPrefs:
            string boxData = JsonUtility.ToJson(_boxParameters);
            PlayerPrefs.SetString("boxData", boxData);

            Debug.Log("UserPrefs: Saved UserPrefs data = " + boxData);
            break;
        }
    }
예제 #5
0
 public void UpdateCube(BoxParameters box)
 {
     Vector3 size = new Vector3(box.width, box.height, box.depth);
     gameObject.transform.localScale = size;
     //gameObject.GetComponent<Renderer>().material.color = box.color;
 }
예제 #6
0
	// Update is called once per frame
	void Update()
	{
		ThatBox = GameObject.Find("Cube").GetComponent<Struct>().myParameters;
		gameObject.transform.position = new Vector3(0, ThatBox.height * 0.5f, -10);		
	}
예제 #7
0
 // Update is called once per frame
 void Update()
 {
     ThatBox = GameObject.Find("Cube").GetComponent <Struct>().myParameters;
     gameObject.transform.position = new Vector3(0, ThatBox.height * 0.5f, -10);
 }