public void Release() { if (target != null) { print("N :"); tb = target.GetComponent <Interactive> (); //tb.transform.parent.SetParent(null); if (tb != null) { if (targetParent != null) { photonView.RPC("ChangeSupport", RpcTarget.All, tb.photonView.ViewID, targetParent.photonView.ViewID); targetParent = null; } else { photonView.RPC("RemoveSupport", RpcTarget.All, tb.photonView.ViewID); } PhotonNetwork.SendAllOutgoingCommands(); print("N !"); caught = false; photonView.RPC("setCaught", RpcTarget.All, tb.photonView.ViewID, false); if (tb.tag == "Handle") { tb.transform.SetParent(chest.transform); } } } else { print("pas N"); } }
void Start() { active = false; caught = false; player = (MonoBehaviourPun)this.GetComponentInParent(typeof(Navigation)); name = player.name + "_" + name; }
public void Catch() { print("B ?"); if (target != null) { print("B :"); var tb = target.GetComponent <Interactive>(); if (tb != null) { if ((!caught) && (this != tb.GetSupport())) // pour ne pas prendre 2 fois l'objet et lui faire perdre son parent { targetParent = tb.GetSupport(); } print("ChangeSupport of object " + tb.photonView.ViewID + " to " + tb.photonView.ViewID); tb.photonView.RPC("ChangeSupport", RpcTarget.All, tb.photonView.ViewID, tb.photonView.ViewID); tb.photonView.TransferOwnership(PhotonNetwork.LocalPlayer); PhotonNetwork.SendAllOutgoingCommands(); caught = true; print("B !"); } } else { print("pas B"); } }
public void Release() { if (target != null) { print("N :"); var tb = target.GetComponent <Interactive>(); if (tb != null) { if (targetParent != null) { tb.photonView.RPC("ChangeSupport", RpcTarget.All, tb.photonView.ViewID, targetParent.photonView.ViewID); targetParent = null; } else { tb.photonView.RPC("RemoveSupport", RpcTarget.All, tb.photonView.ViewID); } PhotonNetwork.SendAllOutgoingCommands(); print("N !"); caught = false; } } else { print("pas N"); } }
[PunRPC] public void ChangeSupport(int interactiveID, int newSupportID) { Interactive go = PhotonView.Find(interactiveID).gameObject.GetComponent <Interactive> (); MonoBehaviourPun s = PhotonView.Find(newSupportID).gameObject.GetComponent <MonoBehaviourPun> (); print("ChangeSupport of object " + go.name + " to " + s.name); go.SetSupport(s); }
// Start is called before the first frame update void Start() { interactionDistance = 4; player = (MonoBehaviourPun)this.GetComponentInParent(typeof(Navigation)); cam = (Camera)GameObject.FindObjectOfType(typeof(Camera)); interactionText = (TMPro.TextMeshProUGUI)GameObject.FindGameObjectWithTag("PowerText").GetComponent <TMPro.TextMeshProUGUI>(); interactionText.text = ""; }
public void SetSupport(MonoBehaviourPun support) { this.support = support; if (support != null && support) { transform.SetParent(support.transform); render.material.color = holdColor; } }
public void SendMessage(int interactiveID, int newSupportID, string type) { MessageIcon go = PhotonView.Find(interactiveID).gameObject.GetComponent <MessageIcon> (); MonoBehaviourPun s = PhotonView.Find(newSupportID).gameObject.GetComponent <MonoBehaviourPun> (); if (go) { go.Send(s, type); } }
public void PushButton(int interactiveID, int newSupportID) { InteractiveButton go = PhotonView.Find(interactiveID).gameObject.GetComponent <InteractiveButton> (); MonoBehaviourPun s = PhotonView.Find(newSupportID).gameObject.GetComponent <MonoBehaviourPun> (); if (go) { go.Push(s); } }
//public Camera camera; void Start() { active = false; caught = false; player = (MonoBehaviourPun)this.GetComponentInParent(typeof(Navigation)); name = player.name + "_" + name; //Ray ray = camera.ScreenPointToRay(Input.mousePosition); }
public void RemoveSupport() { if (parent) { transform.SetParent(parent.transform); } transform.localPosition = this.initialPosition; render.material.color = hoverColor; support = null; }
public static void RpcMaster <E>(this MonoBehaviourPun mb, Action <E> func, E e) { if (PunUtils.offlineOrNoRoom) { func.Invoke(e); return; } mb.photonView.RPC(func.Method.Name, RpcTarget.MasterClient, e); PunRpcProfiler.AddRpcSent(func.Method.Name); }
void Start() { chest = GameObject.FindWithTag("Chest").transform.parent.gameObject; active = false; caught = false; player = (MonoBehaviourPun)this.GetComponentInParent(typeof(Navigation)); name = player.name + "_" + name; interactionText = (TMPro.TextMeshProUGUI)GameObject.FindGameObjectWithTag("WeightText").GetComponent <TMPro.TextMeshProUGUI>(); interactionText.text = ""; }
public void FindPOI(MonoBehaviourPun poi) { PhotonNetwork.RaiseEvent(GameEvents.FindPOI, new object[] { poi.photonView.ViewID }, new RaiseEventOptions { Receivers = ReceiverGroup.Others }, new SendOptions { Reliability = true }); }
public void CreateInteractiveCube() { if (!area.HasWaitingCube()) { MonoBehaviourPun head = signalReceiver.GetHead(); if (PhotonNetwork.CurrentRoom.PlayerCount == 1 || (head != null && head.photonView.IsMine)) { PhotonNetwork.Instantiate(interactiveObjectToInstanciate.name, gameObjectSpawnPoint.transform.position, Quaternion.identity, 0); } } }
public void SetSupport(MonoBehaviourPun support) { this.support = support; if (support != null) { transform.SetParent(support.transform); } else { transform.SetParent(null); } }
public static void Rpc(this MonoBehaviourPun mb, Player player, Action func) { if (PunUtils.offlineOrNoRoom) { if (Equals(player, PhotonNetwork.LocalPlayer)) { func.Invoke(); } return; } mb.photonView.RPC(func.Method.Name, player); PunRpcProfiler.AddRpcSent(func.Method.Name); }
public void Send(MonoBehaviourPun sender, string type) { // appply sender color GetComponent <SpriteRenderer> ().color = new Color( (float)sender.photonView.Owner.CustomProperties["r"], (float)sender.photonView.Owner.CustomProperties["g"], (float)sender.photonView.Owner.CustomProperties["b"], 0.4f ); // apply type icon GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("PortalElements/MessageIcon/" + type); }
public static void RpcSecure(this MonoBehaviourPun mb, RpcTarget target, Action func) { if (PunUtils.offlineOrNoRoom) { if (target == RpcTarget.All) { func.Invoke(); } return; } mb.photonView.RpcSecure(func.Method.Name, target, true); PunRpcProfiler.AddRpcSent(func.Method.Name); }
/// <summary> /// Destroys the given networked object /// </summary> /// <param name="obj">Object to destroy</param> public static void Destroy(MonoBehaviourPun obj) { if (PhotonNetwork.IsConnected) { //If networked, only destroy if owning if (obj.photonView.IsMine) { PhotonNetwork.Destroy(obj.gameObject); } } //otherwise just destroy normally else { Object.Destroy(obj.gameObject); } }
public void RPC(string methodName, RpcTarget target, params object[] parameters) { for (int i = 0; i < parameters.Length; i++) { MonoBehaviourPun asScript = (parameters[i] as MonoBehaviourPun); if (asScript) { parameters[i] = asScript.photonView.ViewID; } PhotonView asView = (parameters[i] as PhotonView); if (asView) { parameters[i] = asView.ViewID; } } this.photonView.RPC(methodName, target, parameters); }
void Start() { mirroredCube = GameObject.Find("Mirrored Cube").gameObject; laser = Instantiate(laserPrefab); laserTransform = laser.transform; Vector3[] initLaserPositions = new Vector3[2] { Vector3.zero, Vector3.zero }; laserLineRenderer.SetPositions(initLaserPositions); laserLineRenderer.SetWidth(laserWidth, laserWidth); active = false; caught = false; player = (MonoBehaviourPun)this.GetComponentInParent(typeof(Navigation)); name = player.name + "_" + name; }
public void Catch() { if (target != null && target.GetType() == typeof(InteractiveHandle)) { //var tb = target.GetComponent<Interactive> (); var support = ((InteractiveHandle)target).GetSupport(); if ((!caught) && (this != support)) // pour ne pas prendre 2 fois l'objet et lui faire perdre son parent { targetParent = support; } //print ("ChangeSupport of object " + target.photonView.ViewID + " to " + photonView.ViewID); photonView.RPC("ChangeSupport", RpcTarget.All, target.photonView.ViewID, photonView.ViewID); target.photonView.TransferOwnership(PhotonNetwork.LocalPlayer); PhotonNetwork.SendAllOutgoingCommands(); caught = true; } }
public void SetSupport(MonoBehaviourPun support) { this.support = support; if (support != null) { if (GetComponent <Rigidbody>() != null) { GetComponent <Rigidbody>().isKinematic = true; print("Picked up"); transform.SetParent(support.transform); } } else { transform.SetParent(null); } }
public void Release() { if (target != null && target.GetType() == typeof(InteractiveHandle)) { //var tb = target.GetComponent<Interactive> (); if (targetParent != null) { photonView.RPC("ChangeSupport", RpcTarget.All, target.photonView.ViewID, targetParent.photonView.ViewID); targetParent = null; } else { photonView.RPC("RemoveSupport", RpcTarget.All, target.photonView.ViewID); } PhotonNetwork.SendAllOutgoingCommands(); caught = false; target = null; } }
void Start() { active = false; caught = false; player = (MonoBehaviourPun)this.GetComponentInParent(typeof(Navigation)); cameraPlayer = (Camera)GameObject.FindObjectOfType(typeof(Camera)); name = player.name + "_" + name; InfoBox = GameObject.Find("Canvas/Bottom Panel/Info Box").GetComponent <Image> (); InfoBoxText = GameObject.Find("Canvas/Bottom Panel/Info Box/Text").GetComponent <Text> (); // custom Color Color color = new Color( (float)player.photonView.Owner.CustomProperties["r"], (float)player.photonView.Owner.CustomProperties["g"], (float)player.photonView.Owner.CustomProperties["b"] ); GetComponentInChildren <Renderer> ().material.color = color; tool.GetComponentInChildren <Renderer> ().material.color = color; }
public ReviveProjectileAbility(GameObject player, Stat[] attributes) : base(player, attributes) { _playerMono = player.GetComponent <MonoBehaviourPun>(); Cooldown = 15f; }
public void RemoveSupport() { transform.SetParent(null); support = null; }
public void Activate(MonoBehaviourPun head = null) { active = true; this.head = head; }
public void Push(MonoBehaviourPun h) { signalOut.Activate(h); previousTime = Time.time; animator.SetTrigger("push"); }