static int Fire2(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); HighlighterController obj = (HighlighterController)ToLua.CheckObject(L, 1, typeof(HighlighterController)); obj.Fire2(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// 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(); } } }
public void ShowCurSlotCenter() { if (curSlot != null) { curSlot.ShowBuildingName(); BuildingData data = mediator.GetDataBySlot(mediator.curSlot); curSlot.level = data.level; curSlot.ShowBuildingLevel(); Vector3 offset = curSlot.cameraOffset; Vector3 pos = new Vector3(curSlot.transform.position.x + offset.x, cameraMove.limitBounds.center.y + cameraMove.limitBounds.extents.y + offset.y, curSlot.transform.position.z - Mathf.Tan(cameraMove.angleXRange.y) * (cameraMove.limitBounds.center.y + cameraMove.limitBounds.extents.y) + offset.z); Vector3 angle = new Vector3(cameraMove.angleXRange.y, 0f, 0f); cameraMove.transform.DOMove(pos, 0.5f).SetEase(Ease.OutCirc); cameraMove.cam.transform.DORotate(angle, 0.5f).SetEase(Ease.OutCirc); targetHighlight = curSlot.modelChild.GetComponent <HighlighterController> (); targetHighlight.Fire2(); ShowBtns(); } }