Exemplo n.º 1
0
        public void RestoreState(object state)
        {
            string       weaponName = (string)state;
            WeaponConfig weapon     = UnityEngine.Resources.Load <WeaponConfig>(weaponName);

            EquipWeapon(weapon);
        }
Exemplo n.º 2
0
 public void EquipWeapon(WeaponConfig weapon)
 {
     if (weapon == null)
     {
         return;
     }
     currentWeaponConfig = weapon;
     currentWeapon.value = AttachWeapon(weapon);
 }
Exemplo n.º 3
0
 void Awake()
 {
     currentWeaponConfig = defaultWeapon;
     currentWeapon       = new LazyValue <Weapon>(SetUpDefaultWeapon);
     equipment           = GetComponent <Equipment>();
     if (equipment)
     {
         equipment.equipmentUpdated += UpdateWeapon;
     }
 }
Exemplo n.º 4
0
        Weapon AttachWeapon(WeaponConfig weapon)
        {
            Animator animator = GetComponent <Animator>();

            return(weapon.Spawn(rightHandTransform, leftHandTransform, animator));
        }