public void RestoreState(object state) { string weaponName = (string)state; WeaponConfig weapon = UnityEngine.Resources.Load <WeaponConfig>(weaponName); EquipWeapon(weapon); }
public void EquipWeapon(WeaponConfig weapon) { if (weapon == null) { return; } currentWeaponConfig = weapon; currentWeapon.value = AttachWeapon(weapon); }
void Awake() { currentWeaponConfig = defaultWeapon; currentWeapon = new LazyValue <Weapon>(SetUpDefaultWeapon); equipment = GetComponent <Equipment>(); if (equipment) { equipment.equipmentUpdated += UpdateWeapon; } }
Weapon AttachWeapon(WeaponConfig weapon) { Animator animator = GetComponent <Animator>(); return(weapon.Spawn(rightHandTransform, leftHandTransform, animator)); }