Exemple #1
0
        static bool Prefix(WeaponPool __instance, int id, ConfigWeapon w, Weapon weapon)
        {
            weapon.TypeId = id;
            weapon.Type   = w.Type;
            weapon.Proto  = __instance.GetProto(w, id);
            if (weapon.Animator == null)
            {
                weapon.Animator = __instance.GetComponent <Animator>();
            }

            var ctrl = WeaponPool_Build_Patch_1.LoadAnimator(w.Animation);

            if (ctrl != null)
            {
                weapon.Animator.runtimeAnimatorController = ctrl;
            }

            if (id != 0)
            {
                ConfigItem configItem = ConfigItem.get(id);
                weapon.name = configItem.Name;
            }
            weapon.SetWeaponImage("Weapon");
            if (ConfigWeapon.getAttackSound(id) != "0")
            {
                weapon.AttackSound.clip = (AudioClip)Resources.Load(ConfigWeapon.getAttackSound(id), typeof(AudioClip));
            }
            return(false);
        }