Exemplo n.º 1
0
        static bool Prefix(WeaponPool __instance, ItemData item, ConfigWeapon w, Weapon weapon)
        {
            weapon.TypeId = item.id;
            weapon.Type   = w.Type;

            var par     = new object[] { w, item };
            var oMethod = typeof(WeaponPool).GetMethod("GetProto", BindingFlags.Instance | BindingFlags.NonPublic);
            var ret     = oMethod.Invoke(__instance, par);

            weapon.Proto = (IWeaponProto)ret;

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

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

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