# PracticeLotsThings.MainGameMonoBehaviour

## CameraController

#### static Camera MainCamera get;

#### static CameraController MainCameraController get;

#### static GameObject MainCameraActor get;

#### int TrackingGameObjectInstanceID get;

如果目前沒有正在追蹤的GameObject，返回-1。

#### void SetPosition(Vector3 position)

#### void AddPosition(Vector3 additive)

#### void Rotate(bool toRight)

#### void Track(GameObject target)

#### void StopTrack()

## Engine

管理器（Managers）與Unity Life Circle的接口。

#### static event Action OnEngineInited

引擎接口完成初始化時發送事件。

#### bool Inited get;

#### static Engine Instance

單例。

#### static NetworkManager NetworkManager

網路連線管理器的單例。所有通用管理器的單例由Engine統一管理，包含創建與引用接口。以下同。

#### static ActorFilter ActorFilter

#### static ActorManager ActorManager

#### static GameManager GameManager

#### void LoadScene(string name, Action onSceneLoaded)

#### static Vector3 GetRamdomPosition()

根據GameSetting設定的場景範圍值返回一個範圍內的隨機位置。

#### static bool IsOutOfRange(Vector3 position)

檢查輸入的座標是否不在GameSetting設定的場景範圍內，若超出範圍則返回true。

#### void CreateObject(int objectID, Action onObjectCreated, Vector3 position, Vector3 angle)

#### void SyncCreateObject(int objectID, Action onObjectCreated, Vector3 position, Vector3 angle)

被其他客戶端同步時使用，同步此客戶端創建物件。

#### void DestroyObject(GameObject obj)

## PhotonEventReceiver

用來接收Photon事件的接收器。

#### static bool Exist

檢查這個接收器是否存在於場景。

#### static event Action OnConnected

#### static event Action OnDisconnected

#### static event Action\<DisconnectCause> OnConnectFail

DisconnectCause為PUN API。

#### static Action OnLobbyJoined

#### static event Action OnRoomCreated

#### static event Action OnRoomJoined

#### static event Action\<PhotonMessageInfo> OnPhotonViewCreated

PhotonMessageInfo為PUN API。

#### static event Action OnRoomLeft

#### static event Action\<Hashtable> OnRoomPropertiesChanged

Hashtable: property name(string) to property value(string)

#### static event Action\<Dictionary\<PhotonPlayer, Hashtable>> OnPlayerPropertiesChanged

Hashtable: property name(string) to property value(string)

#### static event Action\<PhotonPlayer> OnOtherPlayerConnected

PhotonPlayer為PUN API。

#### static event Action\<PhotonPlayer> OnOtherPlayerDisconnected

PhotonPlayer為PUN API。

## PhotonEventSender

用來發送Photon事件的發送器。

#### static event Action OnPhotonEventSenderCreated

#### static event Action OnActorCreated

#### static event Action OnObjectCreated

#### static void CreateActor(int actorID, Vector3 position, Vector3 angle, int photonViewID)

#### static void CreateObject(int objectID, Vector3 position, Vector3 angle, int photonViewID)

#### static void Fire(ShooterActor shooterActor, Vector3 firePosition)

傳入開槍事件的發起者，同步所有客戶端的Shooter開槍。

#### static void Roll(ShooterActor shooterActor, Vector3 direction)

傳入Roll事件的發起者，同步所有客戶端的Shooter執行Roll。

#### static void Attack(ZombieActor zombieActor)

傳入攻擊事件的發起者，同步所有客戶端的ZombieActor攻擊。

#### static void ShowTransformedFromOthers(ZombieActor zombieActor)

傳入轉換事件的發起者，同步所有客戶端的ZombieActor攻擊。

#### static void DestroyActor(Actor actor)

#### static void StartGame()

#### static void EndGame(ActorFilter.ActorType wonActorType)

## Timer

用來驅動TimerManager內計時器。

#### static Timer Instance

單例。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://practicelotsthings.gitbook.io/practicelotsthings/api/practicelotsthings.maingamemonobehaviour.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
