/// <summary> /// Invert color /// </summary> private void InvertColorButtonClick(object sender, EventArgs e) { CloseAllPopUps(sender, e); ImageTask task = new ColorInvert(ImageModification.InvertColor, imageSet); taskControl.Add(task); taskControl.CheckAndProcess(); log.Add("Image color inverted"); }
// TODO: Reduce player's power and drop some power. private IEnumerator DamageSelf(float damage) { animator.SetFloat("Direction", 0); health -= damage; healthBar.fillAmount = health / MaxHealth; healthText.text = $"x{health:0.0}"; invincible = true; controllable = false; SpriteRenderer renderer = self.GetComponent <SpriteRenderer>(); Color col = renderer.color; col.a = 0.5f; renderer.color = col; // TODO: Convert enemy bullets into items within a circle. UDEObjectManager.Instance.DestroyAllBullets(); Vector3 pos = characterTr.position; ColorInvert inv1 = Instantiate <ColorInvert>(circleColorInvert, pos + new Vector3(1.0f, 1.0f, 0), Quaternion.identity); ColorInvert inv2 = Instantiate <ColorInvert>(circleColorInvert, pos + new Vector3(-1.0f, 1.0f, 0), Quaternion.identity); ColorInvert inv3 = Instantiate <ColorInvert>(circleColorInvert, pos + new Vector3(-1.0f, -1.0f, 0), Quaternion.identity); ColorInvert inv4 = Instantiate <ColorInvert>(circleColorInvert, pos + new Vector3(1.0f, -1.0f, 0), Quaternion.identity); inv1.transform.localScale = new Vector3(0.1f, 0.1f, 1); inv2.transform.localScale = new Vector3(0.1f, 0.1f, 1); inv3.transform.localScale = new Vector3(0.1f, 0.1f, 1); inv4.transform.localScale = new Vector3(0.1f, 0.1f, 1); CircleWaveDistortion dist = Instantiate <CircleWaveDistortion>(distortion, pos, Quaternion.identity); dist.Scale = 0.1f; dist.DistortionAlgorithm = CircleWaveDistortion.Algorithm.Polynomial; dist.Distortion = 3; dist.Distortion2 = 2.5f; dist.InnerRadiusRatio = 0.75f; AudioSource dieFX = gameObject.AddComponent <AudioSource>(); dieFX.clip = dieSound; dieFX.volume = 0.7f; dieFX.Play(); float scaleSpeed = 3f; characterTr.position = Camera.main.ViewportToWorldPoint(new Vector3(-0.1f, 0.5f)); UDETransitionHelper.MoveTo( this.gameObject, Camera.main.ViewportToWorldPoint(new Vector3(0.15f, 0.5f)), 1f, UDETransitionHelper.easeLinear, UDETime.TimeScale.PLAYER, false ); yield return(null); float accTime = 0f; while (true) { accTime += Time.deltaTime * UDETime.Instance.PlayerTimeScale; float scale = scaleSpeed * accTime; inv1.transform.localScale = new Vector3(scale, scale, 1); inv2.transform.localScale = new Vector3(scale, scale, 1); inv3.transform.localScale = new Vector3(scale, scale, 1); inv4.transform.localScale = new Vector3(scale, scale, 1); dist.Scale = scale; yield return(null); if (accTime >= 1.5f) { break; } } controllable = true; Destroy(inv1.gameObject); Destroy(inv2.gameObject); Destroy(inv3.gameObject); Destroy(inv4.gameObject); Destroy(dist.gameObject); yield return(StartCoroutine(UDETime.Instance.WaitForScaledSeconds(3f, UDETime.TimeScale.PLAYER))); col.a = 1f; renderer.color = col; Destroy(dieFX); invincible = false; }