Пример #1
0
 public override void OnEvent(DestroyPickupEvent evnt)
 {
     if (BoltNetwork.IsServer)
     {
         BoltNetwork.Destroy(evnt.Entity.gameObject);
     }
 }
Пример #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Car")
     {
         var car = other.GetComponent <PickupUse>();
         DestroyPickupEvent evnt = DestroyPickupEvent.Create(Bolt.GlobalTargets.OnlyServer);
         evnt.Entity = entity;
         evnt.Send();
         if (!car.hasItem)
         {
             car.hasItem     = true;
             car.currentItem = itemToGive;
         }
     }
 }
Пример #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Car" || other.tag == "Forcefield")
        {
            other.TryGetComponent(out Rigidbody rb);
            Debug.LogError(other.GetComponent <Forced>().gameObject);
            try
            {
                other.GetComponent <Forced>().gameObject.SetActive(false);
            }
            catch (System.NullReferenceException e)
            {
                rb.AddForce(transform.up * boomForce);
            }
        }
        foreach (var c in GetComponents <BoxCollider>())
        {
            Destroy(c);
        }
        var evnt = DestroyPickupEvent.Create(Bolt.GlobalTargets.OnlyServer);

        evnt.Entity = this.entity;
        evnt.Send();
    }