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);
                }
            }
        }
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
        // public float distance { get; private set; }

        // public Transform transform { get; private set; }

        internal void PopulateFields(IntPtr vehicle, int wheelNum)
        {
            IntPtr    hitActor = PhysXLib.GetGroundHitActor(vehicle, wheelNum);
            PhysXBody body     = PhysXSceneManager.GetBodyFromPointer(hitActor);

            IntPtr shape = PhysXLib.GetGroundHitShape(vehicle, wheelNum);

            collider = body.GetColliderFromShape(shape);

            PhysXLib.GetGroundHitPosition(vehicle, wheelNum, _pxpoint);
            _pxpoint.ToVector(ref _point);
        }
        internal void PopulateWithUnityObjects(Dictionary <long, PhysXBody> bodies)
        {
            body       = bodies[otherActor.ToInt64()];
            rigidBody  = body as PhysXRigidBody;
            gameObject = body.gameObject;
            transform  = body.transform;

            IntPtr        currentShape    = IntPtr.Zero;
            PhysXCollider currentCollider = null;

            foreach (PhysXContactPoint contactPoint in contactPoints)
            {
                if (contactPoint.colliderShape != currentShape)
                {
                    currentShape    = contactPoint.colliderShape;
                    currentCollider = body.GetColliderFromShape(currentShape);
                }

                contactPoint.collider = currentCollider;
            }
        }
Exemple #5
0
    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);
                }
            }
        }
    }
Exemple #6
0
 public void TriggerEnter(PhysXCollider collider)
 {
     Debug.Log("wop");
 }
Exemple #7
0
 void Start()
 {
     rigidBody = GetComponentInParent <PhysXRigidBody>();
     collider  = GetComponent <PhysXCollider>();
 }
Exemple #8
0
 public int AddCollider(PhysXCollider collider)
 {
     colliders.Add(collider.shape.ToInt64(), collider);
     return(PhysXLib.AttachShapeToRigidBody(collider.shape, physXBody));
 }
        internal void PopulateWithUnityObjects(Dictionary <long, PhysXBody> rigidBodies)
        {
            PhysXBody body = rigidBodies[otherActor.ToInt64()];

            collider = body.GetColliderFromShape(colliderShape);
        }