mirror of
				https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
				synced 2025-06-27 11:58:51 +02:00 
			
		
		
		
	docs(uml): class diagram (#34)
This commit is contained in:
		@@ -5,46 +5,89 @@ skinparam classAttributeIconSize 0
 | 
			
		||||
skinparam classFontStyle Bold
 | 
			
		||||
hide enum methods
 | 
			
		||||
 | 
			
		||||
class Position {
 | 
			
		||||
  {field} + column: Integer
 | 
			
		||||
  {field} + row: Integer
 | 
			
		||||
class Player {
 | 
			
		||||
  {field} + JUMP_FORCE: Double {readOnly}
 | 
			
		||||
  {field} + SPEED: Double {readOnly}
 | 
			
		||||
  {field} + SPEED: Double {readOnly}
 | 
			
		||||
 | 
			
		||||
  {method} + Position(column: Integer, row: Integer)
 | 
			
		||||
  {method} + equals(position: Position)
 | 
			
		||||
  {method} + jump()
 | 
			
		||||
  {method} + isJumping(): boolean
 | 
			
		||||
  {method} + OnCollisionEnter2D(collision : Collision2D)
 | 
			
		||||
  {method} + OnCollisionExit2D(collision : Collision2D)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Level {
 | 
			
		||||
  {field} + songPath: String
 | 
			
		||||
  {field} + backgroundPath: String
 | 
			
		||||
  {field} + speed: Double
 | 
			
		||||
 | 
			
		||||
  {method} + Level()
 | 
			
		||||
}
 | 
			
		||||
Level *--> "*\n- grid" GameObject : <<Is made up of>>
 | 
			
		||||
 | 
			
		||||
abstract class GameObject {
 | 
			
		||||
abstract class LevelElement {
 | 
			
		||||
  {field} + x: Integer
 | 
			
		||||
  {field} + y: Integer
 | 
			
		||||
  {method} + getImagePath(): String {abstract}
 | 
			
		||||
  {method} + safeSides(): List<PositionSide> {abstract}
 | 
			
		||||
}
 | 
			
		||||
GameObject o--> "1\n- " Position : <<Has>>
 | 
			
		||||
GameObject ..> PositionSide : <<Uses>>
 | 
			
		||||
 | 
			
		||||
class Spike extends GameObject {}
 | 
			
		||||
class Obstacle extends LevelElement {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Platform extends Obstacle {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Spike extends Obstacle {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Portal extends LevelElement {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Bumper extends LevelElement {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class LevelEnd extends LevelElement {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
abstract class Level {
 | 
			
		||||
  {field} + jsonPath: String
 | 
			
		||||
  {field} + name: String
 | 
			
		||||
  {field} + musicPath: String
 | 
			
		||||
  {field} + progression: Integer
 | 
			
		||||
 | 
			
		||||
  {field} + totalJumps: Integer
 | 
			
		||||
  {field} + totalAttempts: Integer
 | 
			
		||||
  {field} + killedCount: Integer
 | 
			
		||||
 | 
			
		||||
  {method} + placeElements()
 | 
			
		||||
  {method} + placeElement(levelElement: LevelElement) {static}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class LevelStats extends Stats {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class LevelFactory {
 | 
			
		||||
  {method} + createLevel(jsonPath): Level
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Game {
 | 
			
		||||
  {field} - score: Integer
 | 
			
		||||
 | 
			
		||||
  {method} + start(): void
 | 
			
		||||
  {method} + restart(): void
 | 
			
		||||
  {method} + end(): void
 | 
			
		||||
}
 | 
			
		||||
Game o--> "1\n- currentLevel" Level : <<Has>>
 | 
			
		||||
 | 
			
		||||
enum PositionSide <<enumeration>> {
 | 
			
		||||
  TOP
 | 
			
		||||
  RIGHT
 | 
			
		||||
  BOTTOM
 | 
			
		||||
  LEFT
 | 
			
		||||
}
 | 
			
		||||
Level *--> "- *\nLevelElements" LevelElement : <<Owns>>
 | 
			
		||||
Game *--> "- *\nlevels" Level : <<Owns>>
 | 
			
		||||
Game *--> "- 1\nlevels" LevelFactory : <<Owns>>
 | 
			
		||||
 | 
			
		||||
' {
 | 
			
		||||
    ' "name": "Back on Track",
 | 
			
		||||
    ' "music"
 | 
			
		||||
    ' "elements": [
 | 
			
		||||
    '   {
 | 
			
		||||
    '     "type": "Spike",
 | 
			
		||||
    '     "position": {
 | 
			
		||||
    '       "x": 0,
 | 
			
		||||
    '       "y": 0
 | 
			
		||||
    '     },
 | 
			
		||||
    '   }
 | 
			
		||||
    ' ]
 | 
			
		||||
' }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@enduml
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user