private static void InitOpenDoorAction() { ActionRequirement openActionRequirement = (GameObject owner) => { var doorway = owner.GetComponent <LockedDoorway>(); if (PlayerInventory.Instance.GetItems().Any(item => item.ItemID == doorway.ItemToUnlock)) { return(true); } return(false); }; InteractiveAction action = (GameObject obj) => { var doorway = obj.GetComponent <LockedDoorway>(); PlayerInventory.Instance.RemoveItemFromInventory(doorway.ItemToUnlock); ProcessBarController.StartProcessWithCompletion(3f, doorway.Action.ActionImage, () => doorway.gameObject.SetActive(false), Color.yellow); }; var openDoorAction = new ActionBase(LockedDoorway.kOpenDoorActionId, openActionRequirement, action); _actions.Add(LockedDoorway.kOpenDoorActionId, openDoorAction); }
private void BeginCraftingWithCallback() { var receipt = ItemsData.GetReceiptById(_currentItem.ItemID); var item = ItemsData.GetItems().Find(i => i.ItemID == receipt.ResultingItemId); var sprite = InventoryImagesLoader.GetImageForItem(item.EItemType, item.ItemID); ProcessBarController.StartProcessWithCompletion(receipt.RequiredTime, sprite, () => { PlayerInventory.Instance.TryAddItemToInventory(item); }, Color.cyan); }
private void BeginSettingTrapWithCallback() { var trap = ItemsData.GetTrapById(_currentItem.ItemID); var sprite = InventoryImagesLoader.GetImageForItem(trap.EItemType, trap.ItemID); ProcessBarController.StartProcessWithCompletion(trap.RequiredTime, sprite, () => { var instantiatedTrap = Instantiate(trap.TrapPrefab); instantiatedTrap.transform.position = PlayerBehaviour.CurrentPlayer.transform.position; }, Color.red); }
private static void InitContainerAction() { InteractiveAction action = (GameObject obj) => { ProcessBarController.StartProcessWithCompletion(3f * PlayerQuirks.GetSkill(EPlayerSkills.Scavanging), Resources.Load <Sprite>("Sprites/Actions/action.id.container"), () => { var container = obj.GetComponent <Container>(); ContainerUI.ShowForContainer(container); }, Color.green); }; var containerAction = new ActionBase("action.id.container", (GameObject owner) => { return(true); }, action); _actions.Add("action.id.container", containerAction); }
private static void InitHideAction() { ActionRequirement openActionRequirement = (GameObject owner) => { return(!PlayerQuirks.Attacked); }; InteractiveAction action = (GameObject obj) => { var doorway = obj.GetComponent <Hideout>(); ProcessBarController.StartProcessWithCompletion(1f, doorway.Action.ActionImage, () => { PlayerBehaviour.CurrentPlayer.Renderer.enabled = false; PlayerQuirks.Hidden = true; }, Color.grey); }; var openDoorAction = new ActionBase(Hideout.kHideAction, openActionRequirement, action); _actions.Add(Hideout.kHideAction, openDoorAction); }
private static void InitDragAction() { var undrag = new ActionBase("action.id.undrag", (GameObject obj) => { return(true); }, (GameObject obj) => { RopeDragController.Unbind(obj); PlayerQuirks.Drags = false; }); ActionRequirement openActionRequirement = (GameObject owner) => { return(PlayerInventory.Instance.GetItems().Any(i => i.ItemID == "genericitem.id.rope") && !PlayerQuirks.Drags); }; InteractiveAction action = (GameObject obj) => { ProcessBarController.StartProcessWithCompletion(3f * PlayerQuirks.GetSkill(EPlayerSkills.Hiding), Resources.Load <Sprite>("Sprites/Actions/action.id.drag"), () => { RopeDragController.Bind(obj); }, Color.yellow); }; var drag = new ActionBase("action.id.drag", openActionRequirement, action); _actions.Add(drag.ActionID, drag); _actions.Add(undrag.ActionID, undrag); }