void Command_SetLayerImage(string data, BackgroundController.Layer layer) { string texName = data.Contains(",") ? data.Split(',')[0] : data; Texture tex = Resources.Load("Backgrounds/" + texName) as Texture; float spd = 2f; bool smooth = false; if (data.Contains(",")) { string[] parameters = data.Split(','); foreach (string p in parameters) { float fval = 0; bool bval = false; if (float.TryParse(p, out fval)) { spd = fval; } continue; if (bool.TryParse(p, out smooth)) { smooth = bval; } continue; } } layer.TransitionToTexture(tex, spd, smooth); }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Q)) { layer = controller.background; Debug.Log("Here"); } if (Input.GetKey(KeyCode.T)) { } else { if (Input.GetKey(KeyCode.A)) { Debug.Log("there"); Debug.Log(layer == null); layer.TransitionToTexture(texture); } } }