Пример #1
0
 public void EquipWeapon(GameObject weaponPrefab)
 {
     if (currentWeapon != null)
     {
         Destroy(currentWeapon);
     }
     currentWeapon = Instantiate(weaponPrefab, weaponSlot);
     fireWeapon    = currentWeapon.GetComponent <CallMixinActions>();
 }
Пример #2
0
    public void AddItem(object obj)
    {
        AssetInfo assetInfo = (AssetInfo)obj;

        string assetName = Path.GetFileNameWithoutExtension(assetInfo.assetPath);

        Type assetType = Type.GetType(assetName + ", Assembly-CSharp");

        MixinBase newMixin = (MixinBase)callMixinAction.gameObject.AddComponent(assetType);

        newMixin.showInfo = true;
        newMixin.Name     = assetName;

        int index = mixinList.serializedProperty.arraySize++;

        mixinList.serializedProperty.GetArrayElementAtIndex(index).objectReferenceValue = newMixin;

        serializedObject.ApplyModifiedProperties();
    }