public void Update() { var color = paintBrush.GetColor(transform.position); if (color.a == 0) { foreach (var mat in materials) { mat.color = Color.Lerp(mat.color, Color.white, Time.deltaTime * 10); } } else { foreach (var mat in materials) { mat.color = Color.Lerp(mat.color, color, Time.deltaTime * 10); } ; } //emitter.shooting = Input.GetKey(KeyCode.Space); float steer = Mathf.Clamp01(Input.mousePosition.x / Screen.width) - 0.5f; float tilt = Mathf.Clamp01(Input.mousePosition.y / Screen.height) - 0.5f; emitter.startVelocity = Mathf.Clamp(emitter.startVelocity + Input.GetAxis("Mouse ScrollWheel") * 5, 5, 50); emitter.transform.localRotation = Quaternion.Euler(0, steer * maxSteer, 0) * Quaternion.Euler(-tilt * maxTilt, 0, 0); }
// Update is called once per frame void Update() { WheelHit groundHit; if (wheelCollider.GetGroundHit(out groundHit)) { //Vector3 pos; Quaternion rot; //wheelCollider.GetWorldPose(out pos, out rot); particleSystem.transform.position = groundHit.point; particleSystem.transform.rotation = Quaternion.LookRotation(transform.parent.forward, transform.parent.up); var color = paintBrush.GetColor(transform.position); if (color.a == 1) { //color.r += 0.5f; //color.g += 0.5f; //color.b += 0.5f; particleSystem.startColor = color; particleSystem.enableEmission = true; } else { particleSystem.enableEmission = false; } } else { particleSystem.enableEmission = false; } }
// Update is called once per frame void Update() { //Debug.Log(_car.IsGrounded); if (_car.IsGrounded) { var currentColor = _paintBrush.GetColor(transform.position); ActiveEffect = null; // First, disable all effects that are inactive foreach (var effect in _effects) { if (!CompareColor(currentColor, effect.color)) { effect.enabled = false; } else { ActiveEffect = effect; } } // Now, enable active effect if (ActiveEffect != null) { ActiveEffect.enabled = true; } } //else //{ // foreach (var effect in _effects) // { // effect.enabled = false; // } //} }