static void PassCollider(Collider2D col) { PlayerController player = ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <PlayerController>(); player.CheckForInteractableMenu(col); Destroy(currentMenu); }
private IEnumerator HarvestNode() { PlayerStateMachine psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; string shake = "Shake"; //while player is harvesting, count down timer while (psm.currentState == StateMachine.States.Harvesting) { stateMachine.anim.SetTrigger(shake); //something here is null yield return(new WaitForSeconds(1f)); harvestTimer -= 1; if (harvestTimer == 0) //if timer hits 0, die and send player to idle, exit coroutine { stateMachine.anim.ResetTrigger(shake); stateMachine.RequestChangeState(StateMachine.States.Dead); psm.RequestChangeState(StateMachine.States.Idle); yield return(null); } } //if while loop is ended by player changing states, go back to idle because player was interrupted stateMachine.anim.ResetTrigger(shake); stateMachine.RequestChangeState(StateMachine.States.Idle); yield break; }
public EquipmentManager EquipmentManager() { if (equipmentManager == null) { equipmentManager = ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <EquipmentManager>(); } return(equipmentManager); }
void TriggerAttack() { Debug.Log("Player is attacking " + gameObject.name); UnitStateMachine u = ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <UnitStateMachine>(); u.currentThreat = transform; u.RequestChangeState(StateMachine.States.Fight); }
private void Start() { ApplicationManager app = ApplicationManager.GetInstance(); DataManager dm = app.GetDataManager(); dm.SaveCurrentScene(); player = ScriptToolbox.GetInstance().GetPlayerManager().player.transform; }
private void Start() { shop = InventoryManager.GetInstance().GetShopInventory(); shop.onInventoryChanged += UpdateUI; slots = itemsParent.GetComponentsInChildren <ShopSlot>(); psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; AssignSlotNums(); }
void Start() { playerWallet = ScriptToolbox.GetInstance().GetPlayerWallet(); inv = InventoryManager.GetInstance().GetInventory(); shop = InventoryManager.GetInstance().GetShopInventory(); shopDialogue = InventoryManager.GetInstance().GetShopDialogue(); qntyPrompt = InventoryManager.GetInstance().GetQuantityPrompt(); psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; }
protected override void GatherComponents() { base.GatherComponents(); equipmentManager = GetComponent <EquipmentManager>(); inventory = InventoryManager.GetInstance().GetInventory(); wallet = ScriptToolbox.GetInstance().GetPlayerWallet(); myBody = GetComponent <BodyPartController>(); combatSkills = GetComponent <CombatSkills>(); }
private void TriggerHarvest() { if (UsingProperTool() && !harvested) { //not saving these in Start theoretically reduces time to load on start when a scene has many nodes ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine.RequestChangeState(StateMachine.States.Harvesting); GetComponent <NodeStateMachine>().RequestChangeState(StateMachine.States.Harvesting); Debug.Log("Starting harvest!"); } }
void Awake() { if (instance != null) { Debug.LogWarning("More than one instance of ScriptToolbox found"); return; } instance = this; GatherComponents(); }
protected override void OnStateEnter() { base.OnStateEnter(); //if we are able to enter this state, put the player their too because they requested it PlayerStateMachine psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; psm.RequestChangeState(StateMachine.States.Talking); npc.unitAnim.FaceDirection(transform.position, npc.player.position); ScriptToolbox.GetInstance().GetDialogueManager().StartDialogue(npc.dialogue); }
protected override void OnStateEnter() { base.OnStateEnter(); //if we are able to enter this state, put the player their too because they requested it PlayerStateMachine psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; psm.RequestChangeState(StateMachine.States.Shopping); npc.unitAnim.FaceDirection(transform.position, npc.player.position); ShopInventoryUI.instance.ShopUIToggle(true, name); npc.myShop.LoadShopInventory(); }
private void ProcessClick() { ScriptToolbox.GetInstance().GetWindowCloser().DestroyPopupMenus(); if (clickInfo.clickType == "leftClick") { ProcessLeftClick(); } else { InteractWithInteractable(clickInfo.interaction, clickInfo.interactable); } }
public void UnitExitingDialogueState(bool playerRequestedExit = false) { if (isOpen) { CloseDialogueWindow(); unitTalking.RequestChangeState(StateMachine.States.Idle); } //if the player requested the change, put the other unit into the Idle state if (!playerRequestedExit) { ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine.RequestChangeState(StateMachine.States.Idle); } }
private void InventoryUIToggle() { if (Input.GetButtonDown("Inventory")) { if (inventoryUI.activeSelf) //if already active go to idle { psm.RequestChangeState(StateMachine.States.Idle); } else { psm.RequestChangeState(StateMachine.States.InvOpen); } ScriptToolbox.GetInstance().GetWindowCloser().DestroyPopupMenus(); } }
//for units to call in their own exit states if knocked out of shopping public void UnitExitingShopState(bool unitIsPlayer = false) { //this method will always be called even after pressing the exit button because each unit's OnStateExit calls this //the if statement prevents it from going any further if the shop is already inactive if (shopUI.activeSelf) { shopUI.SetActive(false); shopDialogue.SetActive(false); InventoryManager.GetInstance().GetInventoryToggle().CloseInventory(); shop.ClearShopInventory(); } if (!unitIsPlayer) { PlayerStateMachine psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; psm.RequestChangeState(StateMachine.States.Idle); } }
public void RightClickedToSell(Item item) { if (item != null) { float price = PriceChecker.AppraiseItem(item, "Sale") * item.quantity; if (InventoryManager.GetInstance().GetShopInventory().CheckSpaceAndGold(item, item.quantity, price)) { InventoryManager.GetInstance().GetInventory().Remove(item); InventoryManager.GetInstance().GetShopInventory().AddItem(item); //needs to account for quantity ScriptToolbox.GetInstance().GetPlayerWallet().Deposit(price); InventoryManager.GetInstance().GetShopDialogue().SetCurrentMessage(LoadShop.MessageType.SUCCESS); } else { InventoryManager.GetInstance().GetShopDialogue().SetCurrentMessage(LoadShop.MessageType.INVAL_QNTY); } } }
public void ShopUIToggle(bool active, string NPCname = null) { if (NPCname != null) { panel.text = NPCname; } shopUI.SetActive(active); shopDialogue.SetActive(active); if (!active) { shop.ClearShopInventory(); //shopOwner's state is changed in here InventoryManager.GetInstance().GetInventoryToggle().CloseInventory(); psm.RequestChangeState(StateMachine.States.Idle); } else { ScriptToolbox.GetInstance().GetWindowCloser().DestroyPopupMenus(); } }
void Start() { toolbox = ScriptToolbox.GetInstance(); }
private void Start() { psm = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine; }
// Use this for initialization void Start() { combatSkills = ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <CombatSkills>(); combatSkills.onSkillGained += UpdateCombatSkills; skillWindow.text = ""; }
private void Start() { psm = ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <UnitStateMachine>(); }
void Start() { slotClickHelper = InventoryManager.GetInstance().GetSlotClickHelpers(); playerWallet = ScriptToolbox.GetInstance().GetPlayerWallet(); }
//will be used by child classes to Start() state machine protected virtual void LoadComponents() { spriteRend = transform.GetChild(0).GetComponent <SpriteRenderer>(); player = ScriptToolbox.GetInstance().GetPlayerManager().player.transform; anim = GetComponent <Animator>(); }
private void Start() { slot = GetComponentInParent <InventorySlot>(); windowCloser = ScriptToolbox.GetInstance().GetWindowCloser(); }
static void EquipToPlayer(Item item) { ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <EquipmentManager>().FastEquip(item); }
//dialogue ended via continue button private void SoftDialogueExit() { unitTalking.RequestChangeState(StateMachine.States.Idle); ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine.RequestChangeState(StateMachine.States.Idle); CloseDialogueWindow(); }
protected override void OnStateExit() { base.OnStateExit(); ScriptToolbox.GetInstance().GetDialogueManager().UnitExitingDialogueState(true); }
void Start() { player = ScriptToolbox.GetInstance().GetPlayerManager().player.GetComponent <PlayerController>(); }
public float radius = 1f; //same as melee standard in weapon script //can eventually take in more info about the unit interacting if we want to open this up to NPCs public virtual void Interaction(string interaction) { //cache the player, or is it better to just get the singleton's reference when I need it? player = ScriptToolbox.GetInstance().GetPlayerManager().player.transform; }