void OnCollisionEnter2D(Collision2D other) { Kaboom impactant = other.gameObject.GetComponent <Kaboom>(); if ((!recup) && (impactant != null)) { Vector2 realvelocity = impactant.rbody.velocity - rbody.velocity; if ((resitimpact < 0.5f || other.gameObject.tag == "Player") && invudegat < 0) //lol { StartCoroutine(Flicker()); StartCoroutine(Recup()); StartCoroutine(HitSound()); life -= Mathf.Clamp(realvelocity.magnitude, 0, 30); invudegat = 0.2f; } if (life < 0 && !dead) { Die(); } if (other.gameObject.tag == "boss") { rbody.velocity += (Vector2)(other.transform.position - transform.position).normalized * 2000; } } }
private void HandleControlC(object sender, ConsoleCancelEventArgs e) { Tracer.TraceInfo(""); Tracer.TraceInfo($"Organized shutdown starting. Informing {_asyncForInstances.Count} asyncfor instances to terminate."); // Do NOT stop running application e.Cancel = true; // Instead, tell all asyncfor tasks to cancel their work now _cancellationTokenSource.Cancel(); // Don't wait longer than 10 seconds if (_kaboom == null) { _kaboom = new Kaboom(TimeSpan.FromSeconds(10), false); } }
// Start is called before the first frame update void Start() { kaboom = Target.GetComponent <Kaboom>(); StartCoroutine(WaitThenPunch(RepeatWaitDuration)); }