C# Class Glisse, ProjetDUT

Manages the sliding blocks of the level
Inheritance: MonoBehaviour
Exibir arquivo Open project: lutrampal/ProjetDUT

Public Properties

Property 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

Public Methods

Method 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

Protected Methods

Method Description
playSound ( int clipNumber ) : void

Plays a sound.

Method Details

OnCollisionEnter2D() public method

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
return void

OnCollisionExit2D() public method

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
return void

OnCollisionStay2D() public method

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
return void

Start() public method

public Start ( ) : void
return void

Update() public method

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

annonce_mort() public method

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
return void

fonctBlocDestruction() public method

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
return void

fonctCollisionDestruction() public method

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
return void

fonctCollisionEnter() public method

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
return void

fonctCollisionExit() public method

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
return void

fonctIncrementScore() public method

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
return void

playSound() protected method

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

Property Details

GlisseClips public_oe property

Array containing all the Glisse's songs
public AudioClip[],UnityEngine GlisseClips
return 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
return 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
return 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
return 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
return bool

nbCoups public_oe property

The number of hit the block has to take before being destroyed
public int nbCoups
return int

player public_oe property

Symbolizes the player colliding with the block
public PlayerWalk, player
return 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
return GameObject

speed public_oe property

Symbolizes the speed of the block
public float speed
return float

target public_oe property

Is used to keep in check the position where the block is going to
public Vector3 target
return 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
return 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
return GameObject