C# Класс ExamplePongLogic, airconsole-unity-plugin

Наследование: MonoBehaviour
Показать файл Открыть проект

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

Свойство Тип Описание
ball UnityEngine.Rigidbody2D
ballSpeed float
racketLeft UnityEngine.Rigidbody2D
racketRight UnityEngine.Rigidbody2D
uiText Text

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public ResetBall ( bool move ) : void
move bool
Результат void

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

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

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

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

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

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

public Rigidbody2D,UnityEngine ball
Результат UnityEngine.Rigidbody2D

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

public float ballSpeed
Результат float

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

public Rigidbody2D,UnityEngine racketLeft
Результат UnityEngine.Rigidbody2D

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

public Rigidbody2D,UnityEngine racketRight
Результат UnityEngine.Rigidbody2D

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

public Text uiText
Результат Text