Exemplo n.º 1
0
        private void UpdateActiveTarget(bool canPickup, bool canDrill)
        {
            GameObject targetObject = null;

            ObjectType objectType = ObjectType.None;

            if (canPickup || canDrill)
            {
                Targeting.GetTarget(gameObject, 4.8f, out targetObject, out float num);
            }

            if (targetObject)
            {
                GameObject rootObject = UWE.Utils.GetEntityRoot(targetObject);

                rootObject = (!(rootObject != null)) ? targetObject : rootObject;

                if (rootObject.GetComponentProfiled <Pickupable>())
                {
                    if (rootObject.GetComponent <Pickupable>().isPickupable)
                    {
                        targetObject = rootObject;
                        objectType   = ObjectType.Pickupable;
                    }
                    else
                    {
                        targetObject = null;
                    }
                }
                else if (rootObject.GetComponentProfiled <Drillable>())
                {
                    targetObject = rootObject;
                    objectType   = ObjectType.Drillable;
                }
                else
                {
                    targetObject = null;
                }
            }

            activeTarget = targetObject;

            if (activeTarget && currentSelectedArm != SeaTruckArm.None)
            {
                if (canDrill && objectType == ObjectType.Drillable && GetSelectedArmTechType() == SeaTruckDrillArm_Prefab.TechTypeID)
                {
                    GUIHand component = Player.main.GetComponent <GUIHand>();
                    GUIHand.Send(activeTarget, HandTargetEventType.Hover, component);
                }
                else if (canPickup && objectType == ObjectType.Pickupable && GetSelectedArmTechType() == SeaTruckClawArm_Prefab.TechTypeID)
                {
                    Pickupable pickupable = activeTarget.GetComponent <Pickupable>();
                    TechType   techType   = pickupable.GetTechType();

                    HandReticle.main.SetText(HandReticle.TextType.Hand, LanguageCache.GetPickupText(techType), false, GameInput.Button.LeftHand);
                    HandReticle.main.SetIcon(HandReticle.IconType.Hand, 1f);
                }
            }
        }
        private void UpdateActiveTarget(bool canPickup, bool canDrill)
        {
            GameObject targetObject = null;

            TargetObjectType objectType = TargetObjectType.None;

            if (canPickup || canDrill)
            {
                Targeting.GetTarget(seamoth.gameObject, 4.8f, out targetObject, out float num, null);
            }

            if (targetObject)
            {
                GameObject rootObject = UWE.Utils.GetEntityRoot(targetObject);

                rootObject = (!(rootObject != null)) ? targetObject : rootObject;

                if (rootObject.GetComponentProfiled <Pickupable>())
                {
                    targetObject = rootObject;
                    objectType   = TargetObjectType.Pickupable;
                }
                else if (rootObject.GetComponentProfiled <Drillable>())
                {
                    targetObject = rootObject;
                    objectType   = TargetObjectType.Drillable;
                }
                else
                {
                    targetObject = null;
                }
            }

            activeTarget = targetObject;

            if (activeTarget && currentSelectedArm != SeamothArm.None)
            {
                if (canDrill && objectType == TargetObjectType.Drillable && GetSelectedArm().HasDrill())
                {
                    GUIHand component = Player.main.GetComponent <GUIHand>();
                    GUIHand.Send(activeTarget, HandTargetEventType.Hover, component);
                }
                else if (canPickup && objectType == TargetObjectType.Pickupable && GetSelectedArm().HasClaw())
                {
                    Pickupable pickupable = activeTarget.GetComponent <Pickupable>();
                    TechType   techType   = pickupable.GetTechType();

                    HandReticle.main.SetInteractText(LanguageCache.GetPickupText(techType), false, HandReticle.Hand.Left);
                    HandReticle.main.SetIcon(HandReticle.IconType.Hand, 1f);
                }
            }
        }