예제 #1
0
        public static void SwapEquipment(this IEquipmentSwappable swapper, Transform lockerT, Slot slot = Slot.PrimaryTool)
        {
            Equipment fromLocker = swapper.EquipmentLockers[lockerT],
                      fromPlayer = PlayerInput.Instance.Loadout[slot];

            int lockerIndex = Array.IndexOf(swapper.Lockers, lockerT);

            PlayerInput.Instance.Loadout.PutEquipmentInSlot(slot, fromLocker);
            swapper.EquipmentLockers[lockerT]    = fromPlayer;
            swapper.LockerEquipment[lockerIndex] = fromPlayer;

            int       equipmentIndex = Convert.ToInt32(fromPlayer);
            Transform prefab         = PlayerInput.Instance.ToolPrefabs[equipmentIndex];

            MeshRenderer meshR = swapper.Tools[lockerIndex].GetComponent <MeshRenderer>();

            if (prefab == null)
            {
                meshR.enabled = false;
            }
            else
            {
                swapper.Tools[lockerIndex].GetComponent <MeshFilter>().mesh = prefab.GetComponent <MeshFilter>().sharedMesh;
                meshR.enabled   = true;
                meshR.materials = prefab.GetComponent <MeshRenderer>().sharedMaterials;
            }

            GuiBridge.Instance.BuildRadialMenu(PlayerInput.Instance.Loadout);
            GuiBridge.Instance.RefreshEquipped();
        }
예제 #2
0
 public static void InitializeSwappable(this IEquipmentSwappable swapper)
 {
     for (int i = 0; i < swapper.Lockers.Length; i++)
     {
         swapper.EquipmentLockers[swapper.Lockers[i]] = swapper.LockerEquipment[i];
     }
 }
예제 #3
0
        public static PromptInfo GetLockerGadgetPrompt(this IEquipmentSwappable swapper, Transform transform)
        {
            Equipment fromLocker = swapper.EquipmentLockers[transform];

            Prompts.SwapEquipmentHint.Description          = GetLockerSwapDescription(fromLocker, Slot.PrimaryGadget);
            Prompts.SwapEquipmentHint.SecondaryKey         = "Q";
            Prompts.SwapEquipmentHint.SecondaryDescription = GetLockerSwapDescription(fromLocker, Slot.SecondaryGadget);

            if (Prompts.SwapEquipmentHint.Description != null || Prompts.SwapEquipmentHint.SecondaryDescription != null)
            {
                return(Prompts.SwapEquipmentHint);
            }
            else
            {
                return(null);
            }
        }
예제 #4
0
        public static PromptInfo GetLockerToolPrompt(this IEquipmentSwappable swapper, Transform transform)
        {
            Equipment fromLocker = swapper.EquipmentLockers[transform];

            Prompts.SwapEquipmentHint.Description = GetLockerSwapDescription(fromLocker, Slot.PrimaryTool);

            if (Game.Current.Player.PackData.HasUpgrade(EVA.EVAUpgrade.Toolbelt))
            {
                Prompts.SwapEquipmentHint.SecondaryKey         = "Q";
                Prompts.SwapEquipmentHint.SecondaryDescription = GetLockerSwapDescription(fromLocker, Slot.SecondaryTool);
            }

            if (Prompts.SwapEquipmentHint.Description != null || Prompts.SwapEquipmentHint.SecondaryDescription != null)
            {
                return(Prompts.SwapEquipmentHint);
            }
            else
            {
                return(null);
            }
        }