void OnCollisionEnter2D(Collision2D collision) { var attackHit = Attack.GetAttackHit(collision.gameObject.layer); if (attackHit == AttackHit.HitAndDamage) { var damage = (int)transform.localScale.x.Scale(minScale, maxScale, 1.5f, 5.5f); float knockback; if (sSharedHitSet == null || sSharedHitSet.CheckOrFlag(collision.gameObject)) { knockback = 0f; } else { knockback = 5f; } GameController.Instance.HitNoVelocityReset(collision.gameObject, this, gameObject, damage, knockback); pooled.Release(); } else if (attackHit == AttackHit.HitOnly) { NoDamageCollision(collision.gameObject); } else { pooled.Release(); } }
void Hit(GameObject obj) { var hit = Attack.GetAttackHit(obj.layer); if (hit == AttackHit.HitAndDamage && !hits.CheckOrFlag(obj)) { GameController.Instance.Hit(obj, this, spawnedBy, power * 2, power); audioSource.Play(); Effects.Star(obj.transform.position); } }
void Hit(GameObject obj) { var hit = Attack.GetAttackHit(obj.layer); if (hit != AttackHit.None && !hits.CheckOrFlag(obj)) { var knockback = ((float)power).Scale(1, 10, 5, 10); GameController.Instance.Hit(obj, this, player.gameObject, (int)knockback, knockback); Effects.Star(obj.transform.position); } }