Server.GameObject.checkCollision C# (CSharp) Méthode

checkCollision() public méthode

checkCollision() checks the collision between two GameObjects.
Collision detection is based upon the radius of the objects and the distance between them.
public checkCollision ( GameObject object2 ) : bool
object2 GameObject An instance to a GameObject
Résultat bool
        public virtual bool checkCollision(GameObject object2)
        {
            //if (this == object2) return false;
            float distance = (float)(Math.Sqrt(Math.Pow((this.x - object2.x), 2) + Math.Pow(this.y - object2.y, 2)));
            if (distance < this.radius + object2.radius) return true;
            return false;
        }