Exemple #1
0
		public override bool CheckCollision(Collider other)
		{
			var collided = false;

			var collider = other as CircleCollider;
			if (collider != null)
			{
				var distance = Vector2.Distance(Entity.GetComponent<Transform>().Position + Offset,
					collider.Entity.GetComponent<Transform>().Position + collider.Offset);

				if (distance <= Radius + collider.Radius)
				{
					OnCollideEvent(this, collider);
					collided = true;
				}
			}

			base.CheckCollision(other);

			return collided;
		}
Exemple #2
0
		protected void OnCollideEvent(Collider myCollider, Collider other)
		{
			CollideEvent?.Invoke(myCollider, other);
		}
Exemple #3
0
		public virtual bool CheckCollision(Collider other)
		{
			Checked = true;
			return true;
		}