private void HeroOnCollisionWithObjects(GameObject sender, GameObject gameObject) { if(gameObject is Hero) { _heroWasCollided = true; IgnoreCollisions = true; } }
private void HeroOnTakeDamageEvent(GameObject sender, float amount) { Camera.Rumble(0.2f, 4, 4); Game.g_Gamepad.Vibrate(0.6f, 0.6f, 0.2f); }
public void RemoveObject(GameObject gameObject) { _deleteObjectsQueue.Enqueue(gameObject); }
public float DistanceToObject(GameObject g1, GameObject g2) { return (float)Math.Sqrt(Math.Pow(g1.Position.X - g2.Position.X, 2) + Math.Pow(g1.Position.Y - g2.Position.Y, 2)); ; }
public Vector2 DirectionToObject(GameObject g1, GameObject g2) { float angle = (float)Math.Atan2(g1.Position.Y - g2.Position.Y, g1.Position.X - g2.Position.X); return new Vector2(-(float)Math.Cos(angle), -(float)Math.Sin(angle)); }
public void AddObject(GameObject gameObject) { _addNewObjectsQueue.Enqueue(gameObject); }
public void CollisionWithObject(GameObject sender, GameObject gameObject) { if(CollisionWithObjects != null) CollisionWithObjects(sender, gameObject); }