예제 #1
0
    //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);
    }