Compare commits

..

4 Commits

Author SHA1 Message Date
5d2168e29c
Merge 8a61ff44fd into 75a3e9144c 2024-12-16 09:22:38 +01:00
75a3e9144c
feat(assets): add missing .meta files 2024-12-16 09:20:14 +01:00
M VINCENT PETT
fd74b170fc
feat: add Square, Scene and Spike (#22) 2024-12-16 08:15:53 +00:00
f90e8e4408
docs: structure + learn Unity (#17) 2024-12-16 08:57:28 +01:00
15 changed files with 771 additions and 15 deletions

8
Assets/InGame.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b1a17bf2ed0272067af054655c2ac204
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91f0cd7dce4e4ae88aef6e0fb7059f5d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,155 @@
fileFormatVersion: 2
guid: a192a62ef32304b4182909c80a175f39
TextureImporter:
internalIDToNameTable:
- first:
213: -2257217325195158302
second: BaseScene_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: BaseScene_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 512
height: 512
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 2ec92ee4dc0cca0e0800000000000000
internalID: -2257217325195158302
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d38b46024c7affa608631f26f4331ba5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

View File

@ -0,0 +1,180 @@
fileFormatVersion: 2
guid: 47dc11f55d08748cba8ebe3225c8310f
TextureImporter:
internalIDToNameTable:
- first:
213: -7710779685713120251
second: BaseSpike_0
- first:
213: 978792226429369126
second: BaseSpike_1
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: BaseSpike_0
rect:
serializedVersion: 2
x: 47
y: 1066
width: 100
height: 214
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 50475c3babecdf490800000000000000
internalID: -7710779685713120251
vertices: []
indices:
edges: []
weights: []
- serializedVersion: 2
name: BaseSpike_1
rect:
serializedVersion: 2
x: 232
y: 228
width: 839
height: 962
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 62b7c35185e559d00800000000000000
internalID: 978792226429369126
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 94588b12388ed05d9b8ebd9acc096c5c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,155 @@
fileFormatVersion: 2
guid: 0f7d1b0259a624a9487caacedea6b1d1
TextureImporter:
internalIDToNameTable:
- first:
213: -5986989983176976689
second: BaseSquare_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: BaseSquare_0
rect:
serializedVersion: 2
x: 35
y: 23
width: 79
height: 79
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: fc61aeaa450f9eca0800000000000000
internalID: -5986989983176976689
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +0,0 @@
# Diagrammes
## Diagramme UML
Les modélisation UML du projet sont disponibles sous forme de [PlantUML](https://www.plantuml.com) dans ce dossier. Les diagrammes sont générés automatiquement à partir des fichiers `.puml` afin de pouvoir être versionnés et mis à jour facilement. Vous pouvez les consulter en récupérant le contenu des fichiers et en les prévisualisant sur [PlantUML](https://www.plantuml.com/plantuml).
- [Diagramme de classes](./UML/class-diagram.puml)
- [Diagramme d'activités](./UML/activity-diagram/activity-diagram.puml)
- [Diagramme de cas d'utilisation](./UML/use-case-diagram.puml)
- [Diagramme d'états](./UML/state-diagram/state-diagram.puml)
## Diagramme de Gantt
La modélisation du diagramme de Gantt est générée automatiquement à partir du fichier [gant-diagram.gantt](./gantt-diagram.gantt) en utilisant n'importe quel outil de visualisation de diagramme de Gantt. Vous pouvez par exemple installer [GanttProject](https://www.ganttproject.biz/) ou utiliser l'outil en ligne [Online Gantt](https://www.onlinegantt.com/#/gantt).

View File

@ -0,0 +1,14 @@
# Diagrammes
## Diagramme UML
Les modélisations UML du projet sont générés à partir des fichiers `.puml` dans le dossier [UML](./UML). Vous pouvez les consulter en récupérant le contenu des fichiers et en les prévisualisant sur [PlantUML](https://www.plantuml.com/plantuml).
- [Diagramme de classes](./UML/class-diagram.puml)
- [Diagramme d'activités](./UML/activity-diagram/activity-diagram.puml)
- [Diagramme de cas d'utilisation](./UML/use-case-diagram.puml)
- [Diagramme d'états](./UML/state-diagram/state-diagram.puml)
## Diagramme de Gantt
La modélisation du diagramme de Gantt est générée à partir du fichier [gant-diagram.gantt](./gantt-diagram.gantt) en utilisant n'importe quel outil de visualisation de diagramme de Gantt. Vous pouvez par exemple installer [GanttProject](https://www.ganttproject.biz/) ou utiliser l'outil en ligne [Online Gantt](https://www.onlinegantt.com/#/gantt).

231
Documentation/unity.md Normal file
View File

@ -0,0 +1,231 @@
# Unity
Documentation about the basics of [Unity](https://unity.com/) (cross-platform game engine) and most useful things to know, to develop a 2D game.
## Links
- [Unity 6 User Manual](https://docs.unity3d.com/Manual/index.html)
- [YouTube (Game Maker's Toolkit) - The Unity Tutorial For Complete Beginners](https://www.youtube.com/watch?v=XtQMytORBmM)
## Unity Interface (4 panels by default)
- Project (bottom): Contains everything that is in our game, like sprites (2D graphical object/image), sound effects, scripts, fonts, etc. Some of them are made in Unity. We can also import files from our computer.
- Hierarchy (left): Contains all the stuff that's in the current scene.
- Scene (middle): A **scene** is a level in our game. Scene are made up of **GameObjects**.
- Inspector (right): Shows the properties and **components** of the selected **GameObject**.
## GameObject
`GameObject` is an invisible container. Properties:
- **Name**
- **Transform**
- a Position (`X`, `Y`, `Z`)
- a Rotation (`X`, `Y`, `Z`)
- a Scale (`X`, `Y`, `Z`)
- **Components**: to add extra features (e.g: `SpriteRenderer` to display a sprite, `BoxCollider2D` to detect collisions, etc).
To create a new `GameObject`, we can right-click in the `Hierarchy` panel and select `Create Empty`.
`GameObject` can have children `GameObject`s. Nesting `GameObject`s is useful to group objects together, and for example, move them all at once, just by moving the parent `GameObject`.
## Components
### SpriteRenderer
The `SpriteRenderer` component renders the Sprite and controls how it visually appears in a Scene. Fields:
- `Sprite`: to select the sprite to render. We can drag a sprite from the `Project` panel.
### Camera
The `Camera` component renders the scene from the point of view of the camera. Fields:
- `Size`: to zoom in and out.
- `Background`: background color.
### Rigidbody2D
The `Rigidbody2D` component allows a `GameObject` to react to physics (gravity, mass).
### Collider2D
The `Collider2D` component allows a `GameObject` to interact with other `GameObject`s. It allows to detect collisions (control hitboxes).
There are different types of colliders:
- `BoxCollider2D`: a box-shaped collider.
- `CircleCollider2D`: a circle-shaped collider.
etc.
### Script
Allows to make our own custom component with C# code.
`MonoBehaviour` is the base class from which script derives. It offers life cycle functions: `Start`, `Update`, `OnEnable` etc.
It has a property called `gameObject` which is the `GameObject` to which the script is attached. For example, to change the name of the `GameObject` to which the script is attached, we can write `gameObject.name = "New Name";`.
```csharp
using UnityEngine;
public class BirdScript : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
public void Start()
{
}
// Update is called every frame over, over and over again, run as often as it can depending on the frame rate and computer performance
public void Update()
{
}
}
```
## UnityEngine C#
### Script communication with other components (for example with `Rigidbody2D`)
By default, the script is unaware of the other components attached to the `GameObject`.
To access the `Rigidbody2D` component from the script, we can create a public field of type `Rigidbody2D` in the script.
```csharp
using UnityEngine;
public class BirdScript : MonoBehaviour
{
public Rigidbody2D myRigidBody;
}
```
In the Unity Editor, the `myRigidBody` field will appear in the `Inspector` panel. We can drag the `Rigidbody2D` component from the `GameObject` to the `myRigidBody` field.
### Input
To get input from the player, we can use the `Input` class.
For example, to detect when the player presses the `Space` key, we can use the `Input.GetKeyDown` method.
In the following example, when the player presses the `Space` key, the bird object will jump.
```csharp
using UnityEngine;
public class BirdScript : MonoBehaviour
{
public Rigidbody2D rigidBody;
public void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
rigidBody.linearVelocity = Vector2.up * 10;
}
}
}
```
### `Time.deltaTime`
`Time.deltaTime` is the interval in seconds from the last frame to the current one.
It's useful to make the game frame rate independent, as it ensures that the game runs at the same speed on different computers, (code inside `Update` method).
```csharp
using UnityEngine;
public class BirdScript : MonoBehaviour
{
public Rigidbody2D rigidBody;
public void Update()
{
// Move the bird to the right, 5 units per second
transform.position = transform.position + (5 * Time.deltaTime * Vector3.right);
}
}
```
### `Debug.Log`
`Debug.Log` is a method that prints a message to the console, helpful for debugging.
```csharp
using UnityEngine;
public class BirdScript : MonoBehaviour
{
public void Start()
{
Debug.Log("Hello World!");
}
}
```
### `Destroy`
To destroy a `GameObject`, we can use the `Destroy` method. Useful for performance optimization, for example to destroy a pipe that is no longer visible on the screen.
For example, to destroy a pipe when it reaches a certain position on the left side of the screen (`deadZone`):
```csharp
using UnityEngine;
public class PipeMoveScript : MonoBehaviour
{
public float moveSpeed = 5;
public float deadZone = -45;
public void Update()
{
transform.position = transform.position + (Time.deltaTime * moveSpeed * Vector3.left);
if (transform.position.x < deadZone)
{
Destroy(gameObject);
}
}
}
```
### Prefabricated `GameObject`
`GameObject` can be prefabricated. Prefabs are reusable `GameObject`s that can be created and modified in the `Project` panel (like a blueprint), for example to spawn objects in the scene dynamically at runtime, with `Instantiate`.
```csharp
using UnityEngine;
public class PipeSpawnScript : MonoBehaviour
{
public GameObject pipe;
public void Start()
{
Instantiate(pipe, transform.position, transform.rotation);
}
}
```
### `[ContextMenu]`
The `[ContextMenu]` attribute allows to add a custom function to the context menu of the script in the Unity Editor.
It's useful for debugging, to be able to call a function directly from the Unity Editor.
```csharp
using UnityEngine;
public class LogicManagerScript : MonoBehaviour
{
[ContextMenu("AddScore")]
public void AddScore()
{
Debug.Log("Score added!");
}
}
```

View File

@ -14,8 +14,11 @@ Développement d'une reproduction du jeu [Geometry Dash](https://fr.wikipedia.or
- [Sujet](./Documentation/Sujet-Projet-Geometry-Dash.pdf) - [Sujet](./Documentation/Sujet-Projet-Geometry-Dash.pdf)
- [Kanban Board (Trello)](https://trello.com/b/ugG5Siaw/cnam-geometry-dash) - [Kanban Board (Trello)](https://trello.com/b/ugG5Siaw/cnam-geometry-dash)
- [Diagrammes UML](./UML) - [Explication Diagrammes](./Documentation/diagrammes.md)
- [Diagramme de GANTT](./Documentation/gantt-diagram.gantt)
- [Diagrammes UML](./Documentation/UML)
- [Conventions développement informatique](./Documentation/conventions.md) - [Conventions développement informatique](./Documentation/conventions.md)
- [Unity - Prise de notes (Anglais)](./Documentation/unity.md)
## Prérequis ## Prérequis