示例#1
0
//	private void SetProps ()
//	{
//		while (PropsCount < _requireCount)
//		{
//			var propsFromCache = PhotonNetwork.PrefabCache.Where (x => string.Equals(x.Key,_propsPrefab.name));
//
//			foreach (var curProps in propsFromCache)
//			{
//				Debug.Log (curProps.Value.gameObject.name);
//				//InitializePropsInPropsList (curProps.Value.gameObject);
//			}
//		}
//	}

    public virtual void AddProps()
    {
        Vector3 newPosition = PositionalManager.CalculatePosionReplaceObjectOnPlanet(_propsPrefab.transform, _world.transform);

        GameObject newProps = PhotonNetwork.InstantiateSceneObject(_propsPrefab.name, Vector3.zero, Quaternion.identity, 0, null);

        PositionalManager.ReplaceObjectOnPlanet(ref newProps, _world, newPosition);

        InitializePropsInPropsList(newProps);
    }
示例#2
0
    public virtual void RemoveProps(GameObject props)
    {
        int     propsIndex  = _propsList.FindIndex(item => item.Equals(props));
        Vector3 newPosition = PositionalManager.CalculatePosionReplaceObjectOnPlanet(_propsPrefab.transform, _world.transform);

        photonView.RPC("ReplaceProps", PhotonTargets.All, propsIndex, newPosition);
//		PhotonNetwork.Destroy (_propsList [propsIndex].gameObject);
//
//		_propsList.RemoveAt (propsIndex);
//
//		AddProps ();
    }
示例#3
0
    public virtual void OnJoinedRoom()
    {
        GameObject player = PhotonNetwork.Instantiate(_player.name, _playerSpawnPoint.position, _playerSpawnPoint.rotation, 0);

        Vector3 newPosition = PositionalManager.CalculatePosionReplaceObjectOnPlanet(player.transform, _world.transform);

        PositionalManager.ReplaceObjectOnPlanet(ref player, _world, newPosition);

        _lobbyCamera.SetActive(false);

        if (OnJoinRoom != null)
        {
            OnJoinRoom();
        }
    }