//TODO: Controls a lot of stuff, may want to refactor public void EquipWeapon(Weapon Weapon, bool pickup = false, GameObject obj = null, bool drop = false) { if (currentWeapon != null) { UnEquipWeapon(drop); } myStats.Equip(Weapon); if (pickup) { currentWeapon = obj; Transform t = currentWeapon.transform; t.parent = weaponHolder.transform; t.localPosition = Vector3.zero; t.rotation = weaponHolder.transform.rotation; } else { currentWeapon = Instantiate(Weapon.model, weaponHolder.transform.position, weaponHolder.transform.rotation, weaponHolder.transform); } weaponGfx = currentWeapon.transform.GetChild(0).gameObject; currentWeapon.GetComponent <Collider>().enabled = false; weaponAnim = currentWeapon.GetComponentInChildren <Animator>(); weaponDialogue = currentWeapon.GetComponent <DialogueTrigger>(); weaponDialogue.disableDialogueObject(); AttackEvent weapAttackEvent = currentWeapon.GetComponent <AttackEvent>(); weaponBox = weapAttackEvent.GetCollider(); weaponBox.enabled = false; weaponBoxScript = weapAttackEvent.GetWeapBoxScript(); weaponBoxScript.setDamage(myStats.Strength); }
public HitEnemyBox GetWeapBoxScript() { if (weaponBoxScript == null) { weaponBoxScript = GetComponentInChildren <HitEnemyBox>(); return(weaponBoxScript); } else { return(weaponBoxScript); } }
private void Start() { player = PlayerManager.instance.Player.GetComponent <PlayerController>(); if (col == null) { col = GetComponentInChildren <Collider>(); } if (weaponBoxScript == null) { weaponBoxScript = GetComponentInChildren <HitEnemyBox>(); } }