public void FreezePlayer(NetworkViewID CapturedID) { NetworkView CapturedView = NetworkView.Find(CapturedID); CapturedView.gameObject.GetComponent <FPSInputControl>().isFrozen = true; CapturedView.gameObject.GetComponent <FPSInputController>().isFrozen = true; }
void EmitBladeParticle(NetworkViewID id, string name, int i) { script = NetworkView.Find(id).GetComponentsInChildren <BladeProjectile>(); if (i == 1) { time = Time.time; NetworkView.Find(id).animation.CrossFade(name); GameSoundCommands.instance.PlayBladeSheathe(); blade = true; foreach (BladeProjectile e in script) { e.enabled = true; assignToPrefab(this, e); } foreach (GameObject g in particle) { g.particleEmitter.emit = true; } } else { NetworkView.Find(id).animation.CrossFade(name); GameSoundCommands.instance.PlayBladeUnSheathe(); blade = false; foreach (BladeProjectile e in script) { e.enabled = false; } foreach (GameObject g in particle) { g.particleEmitter.emit = false; } } }
// 아이템 획득 처리. void GetItemOnNetwork(NetworkViewID viewId) { // 픽업 플래그. if (isPickedUp) { return; } isPickedUp = true; // 픽업한 Player를 찾는다. NetworkView player = NetworkView.Find(viewId); if (player == null) { return; } // 픽업한 Player에게 아이템을 준다. if (player.isMine) { player.SendMessage("GetItem", kind); } else { player.networkView.RPC("GetItem", player.owner, kind); } Network.Destroy(gameObject); Network.RemoveRPCs(networkView.viewID); }
public void Destroy(NetworkViewID v) { NetworkView nw = NetworkView.Find(v); nw.enabled = false; Component.Destroy(nw); }
public void NetworkDrawCard(NetworkViewID ID, int idx) { GameObject image = NetworkView.Find(ID).observed.gameObject; Card card = CardSet.GetCard(idx); foreach (TextMesh t in image.GetComponentsInChildren <TextMesh>()) { switch (t.gameObject.name) { case "BuyCost": t.text = card.buyCost.ToString(); break; case "UseCost": t.text = card.useCost.ToString(); break; case "Text": t.text = card.fullText; break; case "Name": t.text = card.name; break; } } }
public void disableWeapon(NetworkViewID id, int i) { if (tag == "Player") { NetworkView.Find(id).GetComponent <CarRally>().removeWeapon(i); } }
public void useVehicle(NetworkViewID id, int slot_x, int slot_y) { if (!base.GetComponent <Life>().dead) { Inventory component = base.GetComponent <Inventory>(); if (component.items[slot_x, slot_y].id == 20000) { if (component.items[slot_x, slot_y].state == "f") { GameObject gameObject = NetworkView.Find(id).gameObject; if (gameObject != null) { gameObject.GetComponent <Vehicle>().fill(50); component.items[slot_x, slot_y].state = "e"; component.syncItem(slot_x, slot_y); } } else if (component.items[slot_x, slot_y].state == "e") { GameObject gameObject1 = NetworkView.Find(id).gameObject; if (gameObject1 != null && gameObject1.GetComponent <Vehicle>().fuel >= 50) { gameObject1.GetComponent <Vehicle>().burn(50); component.items[slot_x, slot_y].state = "f"; component.syncItem(slot_x, slot_y); } } } } }
void DoBuild(int dir, NetworkViewID thingID) { north.GetComponent <PressButton>().DoDestroy(); east.GetComponent <PressButton>().DoDestroy(); south.GetComponent <PressButton>().DoDestroy(); west.GetComponent <PressButton>().DoDestroy(); Transform buildPoint; if (dir == NORTH) { buildPoint = north; } else if (dir == EAST) { buildPoint = east; } else if (dir == SOUTH) { buildPoint = south; } else { buildPoint = west; } Transform thing = NetworkView.Find(thingID).transform; thing.position = transform.position; thing.rotation = buildPoint.rotation; thing.parent = transform.parent; }
/*void Update() * { * if(GetComponent<NetworkView>().isMine && !spawnedCards) * { * spawnedCards=true; * for(int i = 0; i<cards.Length; i++) * { * * } * } * }*/ [RPC] void SpawnCard(int i, NetworkViewID viewID) { GameObject go = NetworkView.Find(viewID).gameObject; //if(networkView.isMine) { Card c = go.GetComponent <Card>(); c.name = CardDatabase.instance.cards[cards[i]].name; c.type = CardDatabase.instance.cards[cards[i]].type; c.cardTex = CardDatabase.instance.cards[cards[i]].cardPicture; string desc = CardDatabase.instance.cards[cards[i]].descrip.Replace("\\n", "\n"); c.description = desc; string flav = CardDatabase.instance.cards[cards[i]].flavor.Replace("\\n", "\n"); c.flavor = flav; c.statA = CardDatabase.instance.cards[cards[i]].statA; c.statB = CardDatabase.instance.cards[cards[i]].statB; c.neutralCost = CardDatabase.instance.cards[cards[i]].neutralCost; c.redCost = CardDatabase.instance.cards[cards[i]].redCost; c.yellowCost = CardDatabase.instance.cards[cards[i]].yellowCost; c.greenCost = CardDatabase.instance.cards[cards[i]].greenCost; c.blueCost = CardDatabase.instance.cards[cards[i]].blueCost; c.whiteCost = CardDatabase.instance.cards[cards[i]].whiteCost; c.blackCost = CardDatabase.instance.cards[cards[i]].blackCost; c.cardType = CardDatabase.instance.cards[cards[i]].ct; c.playerID = this.playerID; c.cardId = cards[i]; c.rb.isKinematic = true; c.boolA = CardDatabase.instance.cards[cards[i]].boolA; c.boolB = CardDatabase.instance.cards[cards[i]].boolB; } }
void makePlayerInvis(NetworkViewID ID) { NetworkView quitterView = NetworkView.Find(ID); GameObject quitter = quitterView.gameObject; Destroy(quitter); }
void GetNewPlayerState(NetworkPlayer playerInfo, string playerName, int playerTeam, NetworkViewID avatarID, Vector3 initialPosition, Quaternion initialRotation) { Player newPlayer = new Player(); newPlayer.playerInfo = playerInfo; newPlayer.name = playerName; GameObject playerAvatar = NetworkView.Find(avatarID).gameObject; newPlayer.avatar = playerAvatar; newPlayer.team = playerTeam; if (gameType == 1) // If team DM, assign teams at start of game { if (newPlayer.team != my.team) { newPlayer.avatar.tag = "Player_enemy"; } else { newPlayer.avatar.tag = "Player_ally"; } } else if (gameType == 0) // If FFA, all other players assigned as enemies { newPlayer.avatar.tag = "Player_enemy"; } otherPlayers.Add(newPlayer); mainGUI.UpdateAllPlayers(); }
public void swingAnimal(NetworkViewID id, int limb) { if (!base.GetComponent <Life>().dead) { GameObject gameObject = NetworkView.Find(id).gameObject; if (gameObject != null && !gameObject.GetComponent <AI>().dead) { gameObject.GetComponent <AI>().damage((int)((float)MeleeStats.getDamage(base.GetComponent <Clothes>().item) * (1f + base.GetComponent <Skills>().warrior() * 0.4f) * DamageMultiplier.getMultiplierZombie(limb))); if (gameObject.GetComponent <AI>().dead) { base.GetComponent <Skills>().learn(UnityEngine.Random.Range(gameObject.GetComponent <AI>().xp - 1, gameObject.GetComponent <AI>().xp + 2)); if (gameObject.name == "zombie") { if (!base.networkView.isMine) { base.networkView.RPC("killedZombie", base.networkView.owner, new object[0]); } else { base.GetComponent <Player>().killedZombie(); } } else if (!base.networkView.isMine) { base.networkView.RPC("killedAnimal", base.networkView.owner, new object[0]); } else { base.GetComponent <Player>().killedAnimal(); } } } } }
private void NetworkAddToList(NetworkViewID holderID, NetworkViewID objID) { Transform holder = NetworkView.Find(holderID).observed.transform; GameObject obj = NetworkView.Find(objID).observed.gameObject; obj.transform.parent = holder; }
[RPC] void SummonCreature(NetworkViewID viewID, int cretID, NetworkViewID vid2, bool isHero, int player) { Network.Destroy(vid2); NetworkView nv = NetworkView.Find(viewID); CreatureScript cs = nv.GetComponent <CreatureScript>(); print(cretID); cs.playerID = this.playerID; if (isHero) { TurnManager.instance.heroObjects[this.playerID] = cs; cs.playerID = this.playerID; } else { cs.attack = CardDatabase.instance.cards[cretID].statA; cs.health = cs.maxhealth = CardDatabase.instance.cards[cretID].statB; cs.cardTex = CardDatabase.instance.cards[cretID].cardPicture; cs.name = CardDatabase.instance.cards[cretID].name; cs.description = CardDatabase.instance.cards[cretID].descrip; cs.type = CardDatabase.instance.cards[cretID].type; cs.flavor = CardDatabase.instance.cards[cretID].flavor; cs.canAttack = CardDatabase.instance.cards[cretID].boolA; cs.playerID = this.playerID; cs.attacked = CardDatabase.instance.cards[cretID].boolB; string desc = CardDatabase.instance.cards[cretID].descrip.Replace("\\n", "\n"); cs.description = desc; string flav = CardDatabase.instance.cards[cretID].flavor.Replace("\\n", "\n"); cs.flavor = flav; cs.summonSound = CardDatabase.instance.cards[cretID].soundA; cs.attackSound = CardDatabase.instance.cards[cretID].soundB; cs.dieSound = CardDatabase.instance.cards[cretID].soundC; } }
void SetupNewStation(NetworkViewID stationID, NetworkViewID platformID) { Transform station = NetworkView.Find(stationID).transform; Transform platform = NetworkView.Find(platformID).transform; platform.parent = station; }
public void addPlayer(NetworkViewID nwID) { Debug.Log("adding player in player datas"); NetworkView newPlayerInfo = NetworkView.Find(nwID); playerInfoGos.Add(newPlayerInfo.gameObject); }
public void GetButtonDown(string buttonName, NetworkViewID callerID, string callback, NetworkMessageInfo info) { if (Input.GetButtonDown(buttonName)) { NetworkView.Find(callerID).RPC(callback, info.sender); } }
void DoConnection(NetworkViewID outputID) { ChainOutput output = NetworkView.Find(outputID).gameObject.GetComponent <ChainOutput>(); output.targetInput = transform; targetingThis.Add(output); }
// Use this for initialization void Start() { avatars = GameObject.FindObjectsOfType <MovementTypeA>(); completed = new List <int>(); SP = GameObject.FindObjectOfType <SpawnPlayer>(); yourAvatar = NetworkView.Find(Globals.NVID).GetComponent <MovementTypeA>(); }
private void NetworkReceiveSlot(NetworkViewID id) { GameObject obj = NetworkView.Find(id).observed.gameObject; obj.transform.parent = this.gameObject.transform; obj.layer = this.gameObject.layer; obj.GetComponent <ImageAnimator>().Revert(); }
[RPC] void SpawnDeck(NetworkViewID viewID, int id) { GameObject go = NetworkView.Find(viewID).gameObject; DeckScript ds = go.GetComponent <DeckScript>(); ds.playerID = id; TurnManager.instance.playerDecks[id] = ds; }
public void RPC_AddPair(NetworkViewID firstViewID, NetworkViewID secondViewID) { NetworkView first = NetworkView.Find(firstViewID); NetworkView second = NetworkView.Find(secondViewID); this.pairReference = new MergePair(first.gameObject, second.gameObject); this.mergeManager.pairs.Add(this.pairReference); }
void RPCInit(NetworkViewID tgt, int velocity) { NetworkView view = NetworkView.Find(tgt); target = (view == null)? null :view.GetComponent <Alien>(); speed = velocity; initialized = true; }
void requestObjID(NetworkViewID _NVID, NetworkMessageInfo _info) { Debug.Log("sending ID"); int requestedID = NetworkView.Find(_NVID).gameObject.GetComponent <playerID>().ID; NetworkPlayer sender = _info.sender; networkView.RPC("sendObjID", sender, requestedID, _NVID); }
private IEnumerator NetworkTranslateDestroy(NetworkViewID id, Vector3 pos) { GameObject obj = NetworkView.Find(id).observed.gameObject; yield return(StartCoroutine(obj.GetComponent <ImageAnimator>().SmoothMove(pos, ImageAnimator.moveTime))); UnityEngine.Object.Destroy(obj); }
void RemoveViewID(NetworkViewID viewID) { // remove the object if (NetworkView.Find(viewID)) { Destroy(NetworkView.Find(viewID).gameObject); } }
private void RPCAttachOrb(NetworkViewID orb_view_id, NetworkViewID new_view_id) { var orb = NetworkView.Find(orb_view_id).gameObject; orb.networkView.viewID = new_view_id; AttachOrb(orb); }
private void AddPlayer(NetworkViewID viewID, NetworkPlayer player) { int pnum = Int32.Parse(player.ToString()); players[pnum] = NetworkView.Find(viewID).gameObject.GetComponent <Player>(); players[pnum].networkPlayer = player; players[pnum].gameObject.transform.parent = this.gameObject.transform; numPlayers = pnum + 1; }
public void setNumbers(NetworkViewID player, string Uname, string Pword, int Number) { NetworkView playerN = NetworkView.Find(player); playerN.GetComponent <playerController>().activeAccount = new Account(Uname, Pword); playerN.GetComponent <playerController>().playerNumber = Number; if (BasicFunctions.ForkModus) { switch (Number) { case 1: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player1F); break; case 2: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player2F); break; case 3: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player3F); break; case 4: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player4F); break; default: Debug.Log("DIKKE TERROR ERROR"); break; } } else { switch (Number) { case 1: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player1R); break; case 2: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player2R); break; case 3: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player3R); break; case 4: playerN.transform.Find("Circle").renderer.material.SetTexture("_MainTex", Player4R); break; default: Debug.Log("DIKKE TERROR ERROR"); break; } } }
/// <summary> /// Gets the GameObject that this NetworkViewID is attached to /// </summary> /// <param name="viewID"></param> /// <returns></returns> public static GameObject GetGameObject(this NetworkViewID viewID) { if (viewID == NetworkViewID.unassigned) { return(null); } return(NetworkView.Find(viewID).gameObject); }