void ProcessUserInput() { if (ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.SwordAttack)) { AttackWithSword(); } if (_equippedItem != null) { Weapon_Gun_Bow bow = (weapon == null) ? null : weapon.GetComponent <Weapon_Gun_Bow>(); if (weapon != null) { // Aim WeaponB /*Transform t = _playerController.WeaponContainerLeft; * t.forward = _playerController.LineOfSight; * if (bow == null) * { * Vector3 fwd = t.forward; * fwd.y = 0; * t.forward = fwd; * }*/ } // Use Item? bool doUseItem = false; /*if (bow != null) * { * doUseItem = ZeldaInput.GetButtonUp(ZeldaInput.Button.UseItemB); * } * else * { * doUseItem = ZeldaInput.GetButtonDown(ZeldaInput.Button.UseItemB); * }*/ doUseItem = ZeldaInput.GetCommand_Trigger(ZeldaInput.Cmd_Trigger.UseItemB); if (doUseItem) { if (weapon != null) { AttackWithWeaponB(); } _inventory.UseItemB(); } } }
void AttackWithWeaponB() { if (weapon == null || !weapon.CanAttack) { return; } bool canAttack = true; Weapon_Gun_MagicWand wand = weapon.GetComponent <Weapon_Gun_MagicWand>(); // TODO if (wand != null) { wand.spawnFlame = Inventory.Instance.HasItem("MagicBook"); } Weapon_Gun_Bow bow = weapon.GetComponent <Weapon_Gun_Bow>(); // TODO if (bow != null) { canAttack = false; if (_inventory.HasItem("WoodenArrow") || _inventory.HasItem("SilverArrow")) { if (_inventory.HasItem("Rupee")) { _inventory.UseItem("Rupee"); canAttack = true; } } } if (canAttack) { weapon.Attack(ForwardDirection); } }