GetKerbalEvaUnderCursor() public static method

public static GetKerbalEvaUnderCursor ( ) : KerbalEVA
return KerbalEVA
Esempio n. 1
0
        private void UpdateWinchMouseGrab()
        {
            if (Input.GetKeyDown(KeyCode.Mouse1))
            {
                if (clickedWinch)
                {
                    clickedWinch = null;
                    return;
                }
                if (FlightGlobals.ActiveVessel.isEVA)
                {
                    KerbalEVA kerbalEva = KAS_Shared.GetKerbalEvaUnderCursor();
                    if (kerbalEva)
                    {
                        KASModuleWinch winchModule = KAS_Shared.GetWinchModuleGrabbed(kerbalEva.vessel);
                        if (winchModule)
                        {
                            clickedWinch = winchModule;
                            return;
                        }
                    }

                    Transform headTransform = KAS_Shared.GetTransformUnderCursor();
                    if (headTransform)
                    {
                        KAS_LinkedPart linkedPart = headTransform.gameObject.GetComponent <KAS_LinkedPart>();
                        if (linkedPart)
                        {
                            float dist = Vector3.Distance(FlightGlobals.ActiveVessel.transform.position,
                                                          headTransform.position);
                            if (dist <= radius)
                            {
                                clickedWinch = linkedPart.part.GetComponent <KASModuleWinch>();
                                return;
                            }
                        }
                    }
                }
            }
        }