// Use this for initialization void Awake() { Instance = this; PhotonView = GetComponent <PhotonView>(); PhotonNetwork.sendRate = 60; PhotonNetwork.sendRateOnSerialize = 30; SceneManager.sceneLoaded += OnSceneFinishedLoading; //PhotonNetwork.automaticallySyncScene = true; }
public static Stage Create() { GameObject go = new GameObject("Stage"); StageInfo.instance.gameObject.transform.SetParent(go.transform); StageInfo.instance.Score = 0; StageInfo.instance.HitPoints = 0; Utils.AssignTransformFromTo(Design.visibleArea.transform, go.transform); Utils.ProvideCanvas(go); Stage result = go.AddComponent <Stage>(); EnemySpawning enemySpawning = go.AddComponent <EnemySpawning>(); enemySpawning.onShipDeath = new UnityAction <Ship>(result.OnEnemyDeath); PlayerSpawning playerSpawning = go.AddComponent <PlayerSpawning>(); playerSpawning.onShipDeath = new UnityAction <Ship>(result.OnPlayerDeath); playerSpawning.onChangeHitPoints = new UnityAction <Ship>(result.OnPlayerChangeHitPoints); return(result); }