public override void OnCollision(GameObject other) { base.OnCollision(other); if (other.tags.Contains("attackable")) { // // TODO(matheusmortatti) remove time from enemy and give to the player. // var inflicted = ((Enemy)other).TakeHit(Damage); if (inflicted <= 0) { return; } // // Camera shake, brief pause and time particles. // ((Camera)GameObjectManager.FindObjectWithTag("camera"))?.AddShake(0.1); if (other.lifeTime <= 0) { GameObjectManager.AddPause(0.2f); } TimePiece.SpawnParticles((int)Math.Ceiling(inflicted / timeGivenAdjustment), other.collisionBox == null ? other.transform.position : other.collisionBox.middle, GameObjectManager.playerInstance); Debug.Log($"Damage Inflicted to {other.GetType().FullName} : {Math.Ceiling(inflicted).ToString()}"); // // Add force to repel enemy. // Vector2 repelDir = transform.direction; var physics = other.GetComponent <APhysics>(); if (physics == null) { Debug.Log($"{other.GetType().FullName} does not have a physics component. Attacking it does not send it back."); } else { physics.velocity = (repelDir * _repelSpeed); } } }