C# Class Glisse, ProjetDUT

Manages the sliding blocks of the level
Inheritance: MonoBehaviour
Afficher le fichier Open project: lutrampal/ProjetDUT

Méthodes publiques

Свойство Type Description
GlisseClips UnityEngine.AudioClip[]
direction string
down GameObject
left GameObject
moving bool
nbCoups int
player PlayerWalk,
right GameObject
speed float
target Vector3
time int
up GameObject

Méthodes publiques

Méthode Description
OnCollisionEnter2D ( Collision2D collision ) : void

Is called every time an object is colliding. Help to keep in check the surrounding environment of the block.

OnCollisionExit2D ( Collision2D collision ) : void

Is called every time an object doesn't collide anymore. Help to keep in check the surrounding environment of the block.

OnCollisionStay2D ( Collision2D collision ) : void

Is called every time an object keeps colliding. Help to keep in check the surrounding environment of the block.

Start ( ) : void
Update ( ) : void

Update is called every frame possible and make the block move forward

annonce_mort ( ) : void

This function unsets the direction variable of the block's neighbours We need to call it because when we destroy an object, OnCollisionExit isn't called

fonctBlocDestruction ( ) : void

It hit the block one time, if nbCoups is egal to 0 then it destroy the block and it unsets the direction variable of his neighbours

fonctCollisionDestruction ( Collision2D collision ) : void

It destroy the object it's given in parameter, calls the function to increment score, and unset the good "direction variable"

fonctCollisionEnter ( Collision2D collision ) : void

It set an object in the good "direction variable" in order to remember if there was an object next to the block in that direction

fonctCollisionExit ( Collision2D collision ) : void

It unset an object in the good "direction variable" in order to remember if there was an object next to the block in that direction

fonctIncrementScore ( Collision2D collision, int combo ) : void

This function increment the score of the player, it takes the ennemy score and also check if it's in a combo

Méthodes protégées

Méthode Description
playSound ( int clipNumber ) : void

Plays a sound.

Method Details

OnCollisionEnter2D() public méthode

Is called every time an object is colliding. Help to keep in check the surrounding environment of the block.
public OnCollisionEnter2D ( Collision2D collision ) : void
collision Collision2D
Résultat void

OnCollisionExit2D() public méthode

Is called every time an object doesn't collide anymore. Help to keep in check the surrounding environment of the block.
public OnCollisionExit2D ( Collision2D collision ) : void
collision Collision2D
Résultat void

OnCollisionStay2D() public méthode

Is called every time an object keeps colliding. Help to keep in check the surrounding environment of the block.
public OnCollisionStay2D ( Collision2D collision ) : void
collision Collision2D
Résultat void

Start() public méthode

public Start ( ) : void
Résultat void

Update() public méthode

Update is called every frame possible and make the block move forward
public Update ( ) : void
Résultat void

annonce_mort() public méthode

This function unsets the direction variable of the block's neighbours We need to call it because when we destroy an object, OnCollisionExit isn't called
public annonce_mort ( ) : void
Résultat void

fonctBlocDestruction() public méthode

It hit the block one time, if nbCoups is egal to 0 then it destroy the block and it unsets the direction variable of his neighbours
public fonctBlocDestruction ( ) : void
Résultat void

fonctCollisionDestruction() public méthode

It destroy the object it's given in parameter, calls the function to increment score, and unset the good "direction variable"
public fonctCollisionDestruction ( Collision2D collision ) : void
collision Collision2D
Résultat void

fonctCollisionEnter() public méthode

It set an object in the good "direction variable" in order to remember if there was an object next to the block in that direction
public fonctCollisionEnter ( Collision2D collision ) : void
collision Collision2D
Résultat void

fonctCollisionExit() public méthode

It unset an object in the good "direction variable" in order to remember if there was an object next to the block in that direction
public fonctCollisionExit ( Collision2D collision ) : void
collision Collision2D
Résultat void

fonctIncrementScore() public méthode

This function increment the score of the player, it takes the ennemy score and also check if it's in a combo
public fonctIncrementScore ( Collision2D collision, int combo ) : void
collision Collision2D
combo int
Résultat void

playSound() protected méthode

Plays a sound.
protected playSound ( int clipNumber ) : void
clipNumber int Index of the song in the Array of songs
Résultat void

Property Details

GlisseClips public_oe property

Array containing all the Glisse's songs
public AudioClip[],UnityEngine GlisseClips
Résultat UnityEngine.AudioClip[]

direction public_oe property

Symbolizes the direction the object is going to can take : "left, right, up, down" or is null if the object isn't moving
public string direction
Résultat string

down public_oe property

The object on the down side of the block. If there isn't any object it's null
public GameObject down
Résultat GameObject

left public_oe property

The object on the left side of the block. If there isn't any object it's null
public GameObject left
Résultat GameObject

moving public_oe property

If it's true the object is actually moving and if it's false the object is standing still
public bool moving
Résultat bool

nbCoups public_oe property

The number of hit the block has to take before being destroyed
public int nbCoups
Résultat int

player public_oe property

Symbolizes the player colliding with the block
public PlayerWalk, player
Résultat PlayerWalk,

right public_oe property

The object on the right side of the block. If there isn't any object it's null
public GameObject right
Résultat GameObject

speed public_oe property

Symbolizes the speed of the block
public float speed
Résultat float

target public_oe property

Is used to keep in check the position where the block is going to
public Vector3 target
Résultat Vector3

time public_oe property

An int used to symbolize time. It exist because fonctBlocDestruction() was called too many time and the block was taking two hits per collision. So this in helps to regulate the collision rate.
public int time
Résultat int

up public_oe property

The object on the top side of the block. If there isn't any object it's null
public GameObject up
Résultat GameObject