public void OnDrag(PointerEventData eventData) { if (menuTrans.IsNowScene() || menuTrans.InProcess()) { return; } if (isDraging == false) { return; } Vector2 mousePosition; //Debug.Log(eventData.pointerCurrentRaycast.screenPosition); if (GetLocalPosition(eventData.position, out mousePosition)) { //Debug.Log(eventData.delta.y); Position = new Vector2(Position.x, mousePosition.y + offSetY); float factor = (Position.y) / GetBaseHeight(); BlurController.SetBlurSize(factor); } if (eventData.delta.y > 20) { menuTrans.StartTrans(); } }
// Use this for initialization void Start() { instance = this; PPBehaviour = GetComponent <PostProcessingBehaviour>(); settings = PPBehaviour.profile.depthOfField.settings; settings.focalLength = initialFocalLength; PPBehaviour.profile.depthOfField.settings = settings; }
public void startParticle() { master = GameObject.Find("Controller").GetComponent <Controller>(); this.iceSize = master.iceSize; this.waterSize = master.waterSize; this.gasSize = master.gasSize; this.ice = master.ice; this.water = master.water; this.gas = master.gas; this.blurController = master.blurController; this.textureWithShade = master.textureWithShade; this.sp = master.sp; changeToIce(); }
public void OnBeginDrag(PointerEventData eventData) { if (menuTrans.IsNowScene() || menuTrans.InProcess()) { return; } isDraging = true; //Input.multiTouchEnabled = false; mainTrans.ClearState(); Vector2 mousePosition; //Debug.Log(rectTransform); GetLocalPosition(eventData.position, out mousePosition); offSetY = Position.y - mousePosition.y; BlurController.StartBlur(); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } else { Destroy(this); return; } foreach (var blur in blurs) { blur.enabled = false; } isBlurred = false; }
void OnTriggerEnter2D(Collider2D other) { if (other.name.Contains("Room")) { blurController = other.GetComponentInChildren <BlurController>(); textureWithShade = other.GetComponentInChildren <MeshRenderer>(); iceThreshold = other.GetComponent <Room>().iceThreshold; waterThreshold = other.GetComponent <Room>().waterThreshold; if (state == 0) { changeToIce(); } else if (state == 1) { changeToWater(); } else if (state == 2) { changeToGas(); } } }
//public SerialPort sp; // Start is called before the first frame update public void Start() { // foreach (string s in SerialPort.GetPortNames()){ // if (s.Contains("COM")){ // sp = new SerialPort(s, 115200); // break; // } // } highscorelist = new ArrayList(); highscore = GameObject.Find("High Score"); highscore.SetActive(false); blurController = effectCamera.GetComponent <BlurController>(); meshWithText = GameObject.Find("MeshWithTextureFromCamera"); textureWithShade = meshWithText.GetComponent <MeshRenderer>(); try{ sp.Open(); sp.ReadTimeout = 1; } catch { Debug.Log("Arduino inte kopplad"); } GameObject[] ps = GameObject.FindGameObjectsWithTag("Particle"); foreach (GameObject p in ps) { if (p != null) { particles.Add(p); p.GetComponent <ChangeStateParticle>().startParticle(); } } maxParticles = particles.Count; //Start reading from serial monitor Pointy = GameObject.Find("Pointy Thing"); rpm = 0.0f; }
void Update() { //回到开始界面 if (mainTrans.InProcess()) { if (Vector2.Distance(Position, GetOriginalPosition()) >= 0.1f) { Position = Vector2.Lerp(Position, GetOriginalPosition(), Time.deltaTime * 15f); float factor = (Position.y) / (layer.rect.height); BlurController.SetBlurSize(factor); } else { Position = GetOriginalPosition(); mainTrans.CompleteTrans(); BlurController.DeleteBlur(); } } //菜单开启并且没有完全切换到Menu场景时调用。 if (menuTrans.InProcess()) { Vector2 targetV2 = new Vector2(GetOriginalPosition().x, GetOriginalPosition().y + layer.rect.height); if (Vector2.Distance(Position, targetV2) >= 0.1f) { Position = Vector2.Lerp(Position, targetV2, Time.deltaTime * 10f); float factor = (Position.y) / (layer.rect.height); BlurController.SetBlurSize(factor); } else { Position = targetV2; menuTrans.CompleteTrans(); //Debug.Log("MENU_C_Trans"); } } }
public void Awake() { Singleton = this; }
//static float blurSize = 0f; private void Awake() { Instance = this; }