Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (!CheckForCameraController())
        {
            return;
        }
        if (!IsOwner)
        {
            return;
        }
        WorldItem targetItem = HandleItemSelection();

        if (targetItem != null)
        {
            targetItem.Highlight();
        }
        if (im.GetUse() && targetItem != null)
        {
            HandleItemPickup(targetItem);
        }
        if (im.GetDropItem() && actionSlots.shared_item != null)
        {
            actionSlots.DropItem();
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (!CheckForCameraController())
        {
            return;
        }
        if (!isOwner)
        {
            return;
        }
        WorldItem targetItem = null;

        if (cam_controller.GetViewMode() == ViewMode.Shooter)
        {
            Camera cam = cam_controller.controlled_camera;
            targetItem = utils.RayCastExplosiveSelect <WorldItem>(origin: cam.transform.position,
                                                                  path: cam.transform.forward * select_reach_dist,
                                                                  radius: explosive_rad);
        }
        if (targetItem != null)
        {
            targetItem.Highlight();
        }
        if (im.GetPickUp() && targetItem != null)
        {
            AddItemToInventory(targetItem);
        }
        if (im.GetDropItem() && actionSlots.shared_item != null)
        {
            actionSlots.DropItem();
        }
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (!CheckForCameraController())
        {
            return;
        }
        if (!isOwner)
        {
            return;
        }
        ItemRequest targetItem = null;

        if (cam_controller.GetViewMode() == ViewMode.Shooter)
        {
            Camera cam = cam_controller.controlled_camera;
            targetItem = utils.RayCastExplosiveSelect <ItemRequest>(origin: cam.transform.position,
                                                                    path: cam.transform.forward * select_reach_dist,
                                                                    radius: explosive_rad);
        }
        if (prevItem != null && prevItem != targetItem)
        {
            //prevItem.gameObject.GetComponent<ParticleSystem>().Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            ParticleSystem.EmissionModule emitter = prevItem.gameObject.GetComponent <ParticleSystem>().emission;
            emitter.enabled = false;
            prevItem        = null;
        }
        if (targetItem != null)
        {
            if (!targetItem.gameObject.GetComponent <ParticleSystem>().isPlaying)
            {
                targetItem.gameObject.GetComponent <ParticleSystem>().Play();
            }
            ParticleSystem.EmissionModule emitter = targetItem.gameObject.GetComponent <ParticleSystem>().emission;
            emitter.enabled = true;
            prevItem        = targetItem;
        }
        if (im.GetPickUp() && targetItem != null)
        {
            AddItemToInventory(targetItem);
        }
        if (im.GetDropItem() && actionSlots.shared_item != null)
        {
            actionSlots.DropItem();
        }
    }