C# Class ExamplePongLogic, airconsole-unity-plugin

Inheritance: MonoBehaviour
Afficher le fichier Open project: AirConsole/airconsole-unity-plugin

Méthodes publiques

Свойство Type Description
ball UnityEngine.Rigidbody2D
ballSpeed float
racketLeft UnityEngine.Rigidbody2D
racketRight UnityEngine.Rigidbody2D
uiText Text

Méthodes publiques

Méthode Description
Awake ( ) : void
FixedUpdate ( ) : void
OnConnect ( int device_id ) : void

We start the game if 2 players are connected and the game is not already running (activePlayers == null). NOTE: We store the controller device_ids of the active players. We do not hardcode player device_ids 1 and 2, because the two controllers that are connected can have other device_ids e.g. 3 and 7. For more information read: http://developers.airconsole.com/#/guides/device_ids_and_states

OnDestroy ( ) : void
OnDisconnect ( int device_id ) : void

If the game is running and one of the active players leaves, we reset the game.

OnMessage ( int device_id, JToken data ) : void

We check which one of the active players has moved the paddle.

ResetBall ( bool move ) : void
StartGame ( ) : void
UpdateScoreUI ( ) : void

Method Details

Awake() public méthode

public Awake ( ) : void
Résultat void

FixedUpdate() public méthode

public FixedUpdate ( ) : void
Résultat void

OnConnect() public méthode

We start the game if 2 players are connected and the game is not already running (activePlayers == null). NOTE: We store the controller device_ids of the active players. We do not hardcode player device_ids 1 and 2, because the two controllers that are connected can have other device_ids e.g. 3 and 7. For more information read: http://developers.airconsole.com/#/guides/device_ids_and_states
public OnConnect ( int device_id ) : void
device_id int The device_id that connected
Résultat void

OnDestroy() public méthode

public OnDestroy ( ) : void
Résultat void

OnDisconnect() public méthode

If the game is running and one of the active players leaves, we reset the game.
public OnDisconnect ( int device_id ) : void
device_id int The device_id that has left.
Résultat void

OnMessage() public méthode

We check which one of the active players has moved the paddle.
public OnMessage ( int device_id, JToken data ) : void
device_id int
data JToken Data.
Résultat void

ResetBall() public méthode

public ResetBall ( bool move ) : void
move bool
Résultat void

StartGame() public méthode

public StartGame ( ) : void
Résultat void

UpdateScoreUI() public méthode

public UpdateScoreUI ( ) : void
Résultat void

Property Details

ball public_oe property

public Rigidbody2D,UnityEngine ball
Résultat UnityEngine.Rigidbody2D

ballSpeed public_oe property

public float ballSpeed
Résultat float

racketLeft public_oe property

public Rigidbody2D,UnityEngine racketLeft
Résultat UnityEngine.Rigidbody2D

racketRight public_oe property

public Rigidbody2D,UnityEngine racketRight
Résultat UnityEngine.Rigidbody2D

uiText public_oe property

public Text uiText
Résultat Text