public EquipedWeapon Equip(Transform carrier, Transform rightHand, Transform leftHand, Animator animator) { AnimationHandler.OverrideAnimations(animator, animationClip, "Attack"); EquipedWeapon spawnedWeapon = Spawn(carrier, SelectTransform(rightHand, leftHand)); return(spawnedWeapon); }
public virtual EquipedWeapon Spawn(Transform carrier, Transform position) { if (itemObject != null) { GameObject newWeapon = MonoBehaviour.Instantiate(itemObject, position); EquipedWeapon equipedWeapon = newWeapon.AddComponent <EquipedWeapon>(); equipedWeapon.Initialize(carrier, position, hitArea, this); return(equipedWeapon); } return(null); }
protected override void Initialize() { if (!defaultWeapon) { defaultWeapon = Resources.Load("Prefabs/Unarmed") as GenericWeapon; } Animator animator = GetComponent <Animator>(); Weapon weapon = defaultWeapon.GenerateItem() as Weapon; equipedWeapon = weapon.Equip(transform, rightWeaponHolder, leftWeaponHolder, animator); CalculateInitialStats(weapon); }