void SetSelectedEquipment() { currentItem = player.itemHeld; switch (currentItem) { case ItemHeld.Wiper: ResetSeletedItem(); wiperPanel.sprite = selectedBorder; break; case ItemHeld.Spray: ResetSeletedItem(); sprayPanel.sprite = selectedBorder; break; case ItemHeld.Broom: ResetSeletedItem(); mopPanel.sprite = selectedBorder; break; case ItemHeld.Nothing: ResetSeletedItem(); break; default: break; } }
void Start() { playerRB = GetComponent <Rigidbody2D>(); windowToClean = FindObjectOfType <Window>(); itemHeld = ItemHeld.Wiper; horizontalSpeed = data.regularSpeed; upSpeed = data.regularUpSpeed; downSpeed = data.regularDownSpeed; currentItem = 1; playerAnimationScript = GetComponent <PlayerAnimationScript>(); }
private void ItemSelected() { switch (currentItem) { case 1: Debug.Log("Currently Svensson is holding the Wiper Tool"); itemHeld = ItemHeld.Wiper; break; case 2: Debug.Log("Currently Svensson is holding the Spray Tool"); itemHeld = ItemHeld.Spray; break; case 3: Debug.Log("Currently Svensson is holding the Broom"); itemHeld = ItemHeld.Broom; break; } }
public virtual void DropItemHeld() { if (ItemHeld == null) { return; } ItemWeight -= ItemHeld.Weight; ItemHeld.Deselect(); // Place item at feet of character just to their left. // TODO: Alter this to account for not every item having a refShape component? Shouldn't really come up though. float posX = RefShape.XMin - (ItemHeld.RefShape.Width * 0.5f) - Consts.ITEM_DROP_X_BUFF; float posY = RefShape.YMin + (ItemHeld.RefShape.Height * 0.5f); ItemHeld.transform.position = new Vector3(posX, posY, ItemHeld.transform.position.z); // Turn this character's parent (the boat) into the new parent of the item, as it's just sitting on the floor of the boat now. lvlMngr.SetBoatAsParent(ItemHeld); ItemHeld.CharHeldBy = null; ItemHeld = null; }