public override void TriggerEnter(PhysXCollider other) { // we only call Pickup() if "our" character collides with this PickupItem. // note: if you "position" remote characters by setting their translation, triggers won't be hit. // get gunner and driver id of pickup people. // execute if the driver id is mine or if I am the master client and driver id < 0 if (PhotonNetwork.IsMasterClient) { NetworkPlayerVehicle npv = other.GetComponentInParent <NetworkPlayerVehicle>(); if (npv != null && !npv.GetComponent <VehicleHealthManager>().isDead) { if (this.SentPickup) { return; } int gunnerID = npv.GetGunnerID(); int driverID = npv.GetDriverID(); HotPotatoManager hpm = other.gameObject.GetComponentInParent <HotPotatoManager>(); if (hpm.canPickupPotato) { SentPickup = true; GetComponent <PhotonView>().RPC(nameof(PickupPotato_RPC), RpcTarget.All, driverID, gunnerID, npv.teamId); } } } }
public virtual void TriggerEnter(PhysXCollider other) { // we only call Pickup() if "our" character collides with this PickupItem. // note: if you "position" remote characters by setting their translation, triggers won't be hit. PhotonView otherpv = other.GetComponentInParent <PhotonView>(); if (otherpv != null && otherpv.IsMine) { Pickup(otherpv); } }
public override void TriggerEnter(PhysXCollider other) { Debug.Log("health pickup"); // we only call Pickup() if "our" character collides with this PickupItem. // note: if you "position" remote characters by setting their translation, triggers won't be hit. PhotonView otherpv = other.GetComponentInParent <PhotonView>(); if (otherpv != null && otherpv.IsMine) { HealthManager hm = otherpv.gameObject.GetComponent <HealthManager>(); if (hm == null) { hm = otherpv.gameObject.GetComponentInChildren <HealthManager>(); } if (hm != null) { if (!hm.isAtFullHealth) { Pickup(otherpv); } } } }