public void AddEntity(long objectId, string name, GameObject.GameObjectType objectType, GameObject.GameObjectSubType objectSubType) { if (_knownEntities.ContainsKey(objectId)) { return; } GameObject gameObject = new GameObject(objectId) { Name = name, ObjectType = objectType, ObjectSubType = objectSubType }; _knownEntities.TryAdd(objectId, gameObject); OnAddEntitiy?.Invoke(gameObject); }
public bool IsCollision(Rectangle rect, PacmanGameObject.direction direction, GameObject.GameObjectType gameObjectTyp) { switch (gameObjectTyp) { case GameObject.GameObjectType.WALLS: return(IsPacmanMakeCollisionWithWalls(rect, direction)); case GameObject.GameObjectType.DOTS: return(IsPacmanMakeCollisionWithDots(rect, direction)); case GameObject.GameObjectType.PILLS: return(IsPacmanMakeCollisionWithPills(rect, direction)); case GameObject.GameObjectType.GHOSTS: goto case GameObject.GameObjectType.MONSTERS; case GameObject.GameObjectType.MONSTERS: return(IsPacmanMakeCollisionWithMonsters(rect, direction)); } return(false); }