// Update is called once per frame void Update() { FreezeCheck(); BurnCheck(); ShrinkCheck(); if (isDragged) { if (leadingObjectOnDrag) { movement.Drag(leadingObjectOnDrag.position); dragTimer -= Time.deltaTime; if (dragTimer <= 0) { player.TakeDamage(5, Vector2.zero); isDragged = false; attack.SetCanAttack(true); movement.SetCanMove(true); movement.SetCanFly(true); } } else { dragTimer = 0.0f; isDragged = false; player.TakeDamage(1, Vector2.zero); attack.SetCanAttack(true); movement.SetCanMove(true); movement.SetCanFly(true); } } }
private void CheckOutbounds() { if (transform.position.y < -50) { wizardBehavior.TakeDamage(500, Vector2.zero); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && collision.gameObject != mageOwner && canDamage) { WizardBehavior player = collision.GetComponent <WizardBehavior>(); player.TakeDamage(damage, transform.position); player.GetComponent <MovementBehavior>().KnockOut(new Vector2(knockDir.x * dir.x, knockDir.y), knockbackForce); CheckHasEffect(player); MakeExplosion(); canDamage = false; SpellShake(); } }