static int Fire1(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         HighlighterController obj = (HighlighterController)ToLua.CheckObject(L, 1, typeof(HighlighterController));
         obj.Fire1();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #2
0
    //
    public void TargetingRaycast()
    {
        // Current target object transform component
        Transform targetTransform = null;

        // If camera component is available
        if (cam != null)
        {
            RaycastHit hitInfo;

            // Create a ray from mouse coords
            Ray ray = cam.ScreenPointToRay(Input.mousePosition);

            // Targeting raycast
            if (Physics.Raycast(ray, out hitInfo, targetingRayLength, targetingLayerMask.value))
            {
                // Cache what we've hit
                targetTransform = hitInfo.collider.transform;
            }
        }

        // If we've hit an object during raycast
        if (targetTransform != null)
        {
            // And this object has HighlighterController component
            //HighlighterController hc = targetTransform.GetComponentInParent<HighlighterController>();
            HighlighterController hc = targetTransform.parent.GetComponent <HighlighterController>();
            if (hc != null)
            {
                // Transfer input information to the found HighlighterController
                if (Input.GetButtonDown("Fire1"))
                {
                    hc.Fire1();
                }
                if (Input.GetButtonUp("Fire2"))
                {
                    hc.Fire2();
                }
                hc.MouseOver();
            }
        }
    }