当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.GetPhotonView方法代码示例

本文整理汇总了C#中GameObject.GetPhotonView方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.GetPhotonView方法的具体用法?C# GameObject.GetPhotonView怎么用?C# GameObject.GetPhotonView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObject的用法示例。


在下文中一共展示了GameObject.GetPhotonView方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnJoinedRoom

 void OnJoinedRoom()
 {
     //        GameObject player =  PhotonNetwork.Instantiate(prefabName, SpawnPoints[i].position, SpawnPoints[i].rotation, group);
     player = PhotonNetwork.Instantiate(prefabName, SpawnPoint1.position, SpawnPoint1.rotation, group);
        // player.tag = Globals.Tags.Player.ToString();
     player.transform.position = SpawnPoints[player.GetPhotonView().viewID/1000%2].position;
     player.SetActive(true);
     Debug.Log("prefab Name:" + prefabName + " number: " + player.GetPhotonView().viewID +"\nIsActive: " + player.GetActive());
     //create to spawn points
 }
开发者ID:splanger,项目名称:Wacky-Races,代码行数:10,代码来源:NetworkManager.cs

示例2: OnJoinedRoom

    public void OnJoinedRoom()
    {
        if (this.PrefabsToInstantiate != null)
        {
            GameObject controller = GameObject.Find("Control");

            foreach (GameObject o in this.PrefabsToInstantiate)
            {
                Debug.Log("Instantiating: " + o.name);

                Vector3 spawnPos = Vector3.up;
                if (this.SpawnPosition != null)
                {
                    spawnPos = this.SpawnPosition.position;
                }

                Vector3 random = Random.insideUnitSphere;
                random.y = 0;
                random = random.normalized;
                Vector3 itempos = spawnPos + this.PositionOffset * random;
                

                player = PhotonNetwork.Instantiate(o.name, itempos, Quaternion.identity, 0);
                PhotonView photonView = player.GetPhotonView();
                CameraController camera = PlayerCamera.GetComponent<CameraController>();
                camera.enabled = true;
                camera.player = player;
                redPlayers = PunTeams.PlayersPerTeam[PunTeams.Team.red].Count;
                bluePlayers = PunTeams.PlayersPerTeam[PunTeams.Team.blue].Count;
                ExitGames.Client.Photon.Hashtable ht = new ExitGames.Client.Photon.Hashtable();
                ht.Add("ready", false);
                ht.Add("all ready", false);
                PhotonNetwork.player.SetCustomProperties(ht);
                
                

                if (redPlayers > bluePlayers)
                {
                    PhotonNetwork.player.SetTeam(PunTeams.Team.blue);
                    photonView.RPC("ChangeColorToBlue", PhotonTargets.AllBuffered);

                }
                else {
                    PhotonNetwork.player.SetTeam(PunTeams.Team.red);
                    photonView.RPC("ChangeColorToRed", PhotonTargets.AllBuffered);

                }


            }

        }
    }
开发者ID:repelex,项目名称:Droid-Soccer,代码行数:53,代码来源:OnJoinedInstantiate.cs

示例3: Update

	// Update is called once per frame
	void Update () {
		//Debug.Log(completion);
		if (photonView.isMine){
			lifetimeAccum += Time.deltaTime;
			if (completion >= required){
				tempObject = PhotonNetwork.Instantiate(completedBuilding.name,transform.position,transform.rotation,0) as GameObject;
				SetTeam (tempObject.GetPhotonView().viewID,(int)currentTeam, lifetimeAccum);
				DestroyBox(GetComponent<PhotonView>().viewID);
			}
			if (lifetimeAccum >= totalLifetime){
				DestroyBox(GetComponent<PhotonView>().viewID);
			}
		}
	}
开发者ID:ziek-za,项目名称:csc3020h_capstone,代码行数:15,代码来源:Ability_BuilderFoundation.cs

示例4: Execute

    public override ActionResult Execute(AI ai)
    {
        //enemyObject = enemy.Evaluate(ai.DeltaTime, ai.WorkingMemory).GetValue<GameObject>();
        enemyObject = ai.WorkingMemory.GetItem("Wizard").GetValue<RAIN.Entities.Aspects.VisualAspect>().Entity.Form;
        if( enemyObject != null )
        {
            if( enemyObject.GetPhotonView().isMine )
                enemyObject.GetComponent<PlayerController>().TakeDamage((int)ai.WorkingMemory.GetItem("damageToApply").GetValue<int>(),ai.Body.transform);

        }
        if( enemyObject == null )
        {
            Debug.Log("no player to hit");
        }

        return ActionResult.SUCCESS;
    }
开发者ID:jonmann20,项目名称:WizardSurvival,代码行数:17,代码来源:AImeleeAttack.cs

示例5: ApplyWind

    void ApplyWind()
    {
        if(isControlable){
            print ("wind sent");
            data[0] = windForce;
            data[1] = windDirection;

            Transform[] projectiles = projectileHolder.GetComponentsInChildren<Transform>();

            foreach(Transform proj in projectiles){
                if(proj.gameObject.GetPhotonView()!=null){
                    projectile=proj.gameObject;
                    projectile.GetPhotonView().RPC("WindData",PhotonTargets.All,data);
                }
            }
        }
    }
开发者ID:acimbru,项目名称:licenta,代码行数:17,代码来源:WindGenerator.cs

示例6: Start

	// Update is called once per frame
	void Start () {
        Vector3 random = Random.insideUnitSphere;
        random.y = 0;
        random = random.normalized;
        Vector3 itempos = new Vector3(0,11,0) + 10.0f * random;
        player = PhotonNetwork.Instantiate("PlayerSphere", itempos, Quaternion.identity, 0);
        PhotonView photonView = player.GetPhotonView();
        CameraController camera = PlayerCamera.GetComponent<CameraController>();
        camera.enabled = true;
        camera.player = player;
        if (PhotonNetwork.player.GetTeam() == PunTeams.Team.red)
        {
            photonView.RPC("ChangeColorToRed", PhotonTargets.AllBuffered);
        }
        else {
            photonView.RPC("ChangeColorToBlue", PhotonTargets.AllBuffered);
        }
    }
开发者ID:repelex,项目名称:Droid-Soccer,代码行数:19,代码来源:OnLoadInstantiate.cs

示例7: Grab

    void Grab()
    {
        if (grabbed) {
            grabbed.GetPhotonView().RPC("released",PhotonTargets.All);
            grabbed = null;
        }
        else {
            RaycastHit hit;
            Ray ray = new Ray(transform.position, new Vector3(0,-1,0));
            //Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit)) {
                grabbed = hit.collider.gameObject;

                int newID = PhotonNetwork.AllocateViewID();
                grabbed.GetPhotonView().RPC("grabbed",PhotonTargets.All,newID);
                grabbedPosition = hit.transform.position;
                //grabbedBottom = hit.collider.bounds.min.y;
            }
        }
    }
开发者ID:robcavin,项目名称:vr_chess,代码行数:20,代码来源:PointerBehavior.cs

示例8: DespawnObject

	/// <summary>
	/// Despawns the object. Must be called only from master server
	/// </summary>
	/// <param name="obj">Object.</param>
	public virtual void DespawnObject(GameObject obj)
	{
		if (!isMaster)
			return;
		
		int objectID = obj.GetPhotonView ().viewID;
		photonView.RPC ("RPC_DespawnObject", PhotonTargets.AllBufferedViaServer, objectID);
		//[[Updating the list]]
		if(SpawnedObjects.Contains (objectID))
			SpawnedObjects.Remove (objectID);  
	}
开发者ID:risensh1ne,项目名称:Test,代码行数:15,代码来源:NetworkObjectPool.cs

示例9: FindView

	private int FindView(GameObject go)
	{
		return go.GetPhotonView ().viewID;
	}
开发者ID:risensh1ne,项目名称:Test,代码行数:4,代码来源:NetworkObjectPool.cs

示例10: Venediction

 /// <summary>
 /// プレイヤーを全回復させる関数
 /// </summary>
 /// <param name="player">回復させる対象</param>
 private void Venediction(GameObject player)
 {
     if (player)
     {
         // プレイヤーの情報をゲットする
         PlayerChar playerChar = player.GetComponent<PlayerChar>();
         // プレイヤーが取得できれば
         if (playerChar)
         {
             // 他の誰かのHPを回復させる
             gameObject.GetPhotonView().RPC("Recover", player.GetPhotonView().owner, playerChar.GetPlayerData().MaxHP);
             // 処理が完了したので抜ける
             return;
         }
     }
     // 自分のHPを回復させる
     Recover(playerData.MaxHP);
 }
开发者ID:GochiMMO,项目名称:MMO,代码行数:22,代码来源:Sorcerer.cs

示例11: Regene

 /// <summary>
 /// プレイヤーのHPを徐々に回復させる「リジェネ」
 /// </summary>
 /// <param name="player"></param>
 private void Regene(GameObject player)
 {
     // リジェネのスキルを取得する
     SkillBase regeneSkill = SkillControl.GetSkill("リジェネ");
     if (player)
     {
         // プレイヤーのスクリプトを取得する
         PlayerChar playerChar = player.GetComponent<PlayerChar>();
         // playerがプレイヤーならば
         if (player)
         {
             // 回復量を計算する
             int healHP = (int)((float)playerChar.GetPlayerData().MaxHP * (regeneSkill.GetBonus() + regeneSkill.attack));
             // 効果時間を計算する
             float skillTime = 20 + regeneSkill.GetLv() * 5;
             // 回復する時間を計算する
             float healTime = 5f - regeneSkill.GetLv() * 0.2f;
             // リジェネを発動させる
             photonView.RPC("GenerationRegeneration", player.GetPhotonView().owner, healHP, skillTime, healTime);
             return;
         }
     }
     // 回復量を計算する
     int healHp = (int)((float)playerData.MaxHP * (regeneSkill.GetBonus() + regeneSkill.attack));
     // 効果時間を計算する
     float skillTimer = 20 + regeneSkill.level * 5;
     // 回復する時間を計算する
     float healTimer = 5f - regeneSkill.level * 0.5f;
     // リジェネを発動する
     GenerationRegeneration(healHp, skillTimer, healTimer);
 }
开发者ID:GochiMMO,项目名称:MMO,代码行数:35,代码来源:Sorcerer.cs

示例12: Heal

 /// <summary>
 /// ヒール
 /// </summary>
 /// <param name="player">回復させるプレイヤーオブジェクト</param>
 private void Heal(GameObject player)
 {
     // ヒールのスキルを取得する
     SkillBase healSkill = SkillControl.GetSkill("ヒール");
     // プレイヤーが存在すれば
     if (player)
     {
         // プレイヤーの情報を取得する
         PlayerChar playerChar = player.GetComponent<PlayerChar>();
         // プレイヤーが取得できれば
         if (playerChar)
         {
             // そのプレイヤーの場所に回復エフェクトを表示させる
             PhotonNetwork.Instantiate("Magics/HealEffect", player.transform.position + Vector3.up * 1f, Quaternion.identity, 0);
             // 回復させるHPの量を計算する
             int recoverHP = (int)((float)playerChar.GetPlayerData().MaxHP * (healSkill.GetBonus() + healSkill.attack));
             // そのプレイヤーのHPを回復させる
             gameObject.GetPhotonView().RPC("Recover", player.GetPhotonView().owner, recoverHP);
             // 処理が完了したので抜ける
             return;
         }
     }
     // 自分の位置に回復エフェクトを表示させる
     PhotonNetwork.Instantiate("Magics/HealEffect", gameObject.transform.position + Vector3.up * 1f, Quaternion.identity, 0);
     // 自分のHPを回復する
     Recover((int)((float)playerData.MaxHP * (healSkill.GetBonus() + healSkill.attack)));
 }
开发者ID:GochiMMO,项目名称:MMO,代码行数:31,代码来源:Sorcerer.cs


注:本文中的GameObject.GetPhotonView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。