C# Класс Glisse, ProjetDUT

Manages the sliding blocks of the level
Наследование: MonoBehaviour
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
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

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
playSound ( int clipNumber ) : void

Plays a sound.

Описание методов

OnCollisionEnter2D() публичный Метод

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
Результат void

OnCollisionExit2D() публичный Метод

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
Результат void

OnCollisionStay2D() публичный Метод

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
Результат void

Start() публичный Метод

public Start ( ) : void
Результат void

Update() публичный Метод

Update is called every frame possible and make the block move forward
public Update ( ) : void
Результат void

annonce_mort() публичный Метод

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
Результат void

fonctBlocDestruction() публичный Метод

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
Результат void

fonctCollisionDestruction() публичный Метод

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
Результат void

fonctCollisionEnter() публичный Метод

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
Результат void

fonctCollisionExit() публичный Метод

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
Результат void

fonctIncrementScore() публичный Метод

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
Результат void

playSound() защищенный Метод

Plays a sound.
protected playSound ( int clipNumber ) : void
clipNumber int Index of the song in the Array of songs
Результат void

Описание свойств

GlisseClips публичное свойство

Array containing all the Glisse's songs
public AudioClip[],UnityEngine GlisseClips
Результат UnityEngine.AudioClip[]

direction публичное свойство

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
Результат string

down публичное свойство

The object on the down side of the block. If there isn't any object it's null
public GameObject down
Результат GameObject

left публичное свойство

The object on the left side of the block. If there isn't any object it's null
public GameObject left
Результат GameObject

moving публичное свойство

If it's true the object is actually moving and if it's false the object is standing still
public bool moving
Результат bool

nbCoups публичное свойство

The number of hit the block has to take before being destroyed
public int nbCoups
Результат int

player публичное свойство

Symbolizes the player colliding with the block
public PlayerWalk, player
Результат PlayerWalk,

right публичное свойство

The object on the right side of the block. If there isn't any object it's null
public GameObject right
Результат GameObject

speed публичное свойство

Symbolizes the speed of the block
public float speed
Результат float

target публичное свойство

Is used to keep in check the position where the block is going to
public Vector3 target
Результат Vector3

time публичное свойство

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
Результат int

up публичное свойство

The object on the top side of the block. If there isn't any object it's null
public GameObject up
Результат GameObject