Inheritance: MonoBehaviour
Beispiel #1
0
    void AddAgent()
    {
        Vector3 controllerPosition = VRTK.VRTK_SDKManager.instance.scriptAliasRightController.gameObject.transform.position;

        Vector3 whereToInstantiate = new Vector3(
            controllerPosition.x + UnityEngine.Random.Range(-1 * _instantiationFieldRange.x, _instantiationFieldRange.x),
            controllerPosition.y + UnityEngine.Random.Range(-1 * _instantiationFieldRange.y, _instantiationFieldRange.y),
            controllerPosition.z + UnityEngine.Random.Range(-1 * _instantiationFieldRange.z, _instantiationFieldRange.z)
            );

        GameObject agent = Instantiate(_agentPrefab, whereToInstantiate, Quaternion.identity);

        if (_useRainbow)
        {
            int index = UnityEngine.Random.Range(0, _colors.Length);
            agent.GetComponentsInChildren <Renderer>()[1].material.SetColor("_EmissionColor", _colors[index]);
            agent.GetComponent <TrailRenderer>().material.SetColor("_Color", _colors[index]);
            SelfDestruct s = agent.GetComponent <SelfDestruct>();
            if (s != null)
            {
                Debug.Log("HAS S");
                s.SetDestroy(true);
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Creates a running fog that follows the player. (Needs upgrade for SpeedupPowerup).
    /// </summary>
    /// <param name="active">The new active state of the running fog.</param>
    public void SetRunFog(bool active)
    {
        if (!active)
        {
            // Uncouple the running Particles from the player
            // And stop the emission system.

            // Uncouple from the player transform (stop following).
            runFogInstance.transform.SetParent(null);

            // Add the selfdestruct script
            SelfDestruct sd = runFogInstance.GetComponent <SelfDestruct>();
            sd.enabled = true;

            // Set fade-out particle system behaviour
            ParticleSystem ps = runFogInstance.GetComponent <ParticleSystem>();
            ps.loop = false;
            ps.Stop();

            // Destroy reference so new fog can follow the player.
            runFogInstance = null;
        }
        else
        {
            // If no Fog is following the player, create a new particle system.
            if (runFogInstance == null)
            {
                runFogInstance = GameObject.Instantiate(runFogPrefab, transform.position, runFogPrefab.transform.rotation) as GameObject;
                runFogInstance.transform.parent   = transform;
                runFogInstance.transform.rotation = runFogPrefab.transform.rotation;
            }
        }
    }
Beispiel #3
0
    public override void OnInspectorGUI()
    {
        sd = (SelfDestruct)target;

        //DrawDefaultInspector();

        int mode=(int)sd.mode;
        cont=new GUIContent("Type:", "Delay mode used");
        contL=new GUIContent[modeLabel.Length];
        for(int i=0; i<contL.Length; i++) contL[i]=new GUIContent(modeLabel[i], modeTooltip[i]);
        mode = EditorGUILayout.IntPopup(cont, mode, contL, intVal);
        sd.mode=(_DelayMode)mode;

        if(sd.mode==_DelayMode.RealTime){
            cont=new GUIContent("Delay:", "The delay in second before the gameObject is destroyed");
            sd.delay=EditorGUILayout.FloatField(cont, sd.delay);
        }
        else if(sd.mode==_DelayMode.Round){
            cont=new GUIContent("Round:", "The number of round before the gameObject is destroyed");
            sd.round=EditorGUILayout.IntField(cont, sd.round);
        }
        else if(sd.mode==_DelayMode.Turn){
            cont=new GUIContent("Turn:", "The number of turn before the gameObject is destroyed");
            sd.turn=EditorGUILayout.IntField(cont, sd.turn);
        }

        if(GUI.changed){
            EditorUtility.SetDirty(sd);
        }
    }
Beispiel #4
0
 void DestroyAllInstantiatables()
 {
     EnemyController.DestroyAll();
     ForeshadowController.DestroyAll();
     GateController.DestroyAll();
     ExplosionController.DestroyAll();
     SelfDestruct.DestroyAll();
 }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     unit   = GetComponent <UnitController>();
     weapon = GetComponent <FireWeapon>();
     player = GameObject.Find("Player").GetComponent <SelfDestruct>();
     assist = FindObjectOfType <FieldOrientationAssistant>();
     //Debug.Log(player);
 }
Beispiel #6
0
 internal SelfDestructEvent InvokeEvent(SelfDestructEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         SelfDestruct?.Invoke(_api, arg);
     }
     return(arg);
 }
Beispiel #7
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.layer.ToString() == "12") //Thorn Trap
     {
         selfDestruct = GameObject.Instantiate(selfDestruct);
         selfDestruct.transform.position = this.gameObject.transform.position;
         GameObject.Destroy(this.gameObject);
     }
 }
Beispiel #8
0

        
Beispiel #9
0
    void Start()
    {
        SelfDestruct sd = GetComponent <SelfDestruct>();

        if (sd == null)
        {
            gameObject.AddComponent <SelfDestruct>();
        }
    }
Beispiel #10
0
    /// <summary>
    /// Removes the plume associated with this engine.
    /// </summary>
    public virtual void RemovePlume()
    {
        for (int i = 0; i < _exhausts.Length; i++)
        {
            _exhausts[i].startLifetime = 0;
        }
        SelfDestruct selfDestruct = _plume.AddComponent <SelfDestruct>();

        selfDestruct.timer = 1f;
    }
Beispiel #11
0
    private IEnumerator CountDown(float time)
    {
        yield return(new WaitForSeconds(time));

        currentFirework = (GameObject)Instantiate(m_fireWork, new Vector3(0f, 0f, 0f), Quaternion.Euler(0, 0, 0));
        SelfDestruct selfDestructor = currentFirework.AddComponent <SelfDestruct>();

        selfDestructor.LifeTime = 0.8f;
        m_isReady = true;
    }
Beispiel #12
0

        
 // Update is called once per frame
 void Update()
 {
     if (transform.position.sqrMagnitude < distanceToCenter)
     {
         SelfDestruct s = GetComponent <SelfDestruct> ();
         if (s)
         {
             s.DestroyAttached();
         }
     }
 }
Beispiel #14
0
 void ProximityCheck()
 {
     Debug.Log(player);
     player = GameObject.Find("Player").GetComponent <SelfDestruct>();
     if (Vector3.Distance(player.transform.position, transform.position) < 4)
     {
         transform.LookAt(player.transform);
         weapon.Shoot(player.transform, 3);
         player.Execute(2.5f);
     }
 }
Beispiel #15
0
 private void OnEnable()
 {
     if (m_rb == null)
     {
         m_selfDestruct = GetComponent <SelfDestruct>();
         m_rb           = GetComponent <Rigidbody>();
         m_aSource      = GetComponent <AudioSource>();
     }
     StartCoroutine(ScaleDown());
     transform.localScale = Vector3.one;
     m_rb.AddTorque((Random.Range(-m_torqueAdd, m_torqueAdd)), (Random.Range(-m_torqueAdd, m_torqueAdd)), (Random.Range(-m_torqueAdd, m_torqueAdd)), ForceMode.Impulse);
 }
Beispiel #16
0
    public void Damage(UnitController uc, int damage)
    {
        int ind = units.IndexOf(uc);

        player.units[ind].stats["HP"] -= damage;
        if (player.units[ind].stats["HP"] <= 0)
        {
            SelfDestruct sd = uc.GetComponent <SelfDestruct>();
            sd.Execute(3f);
            InitiativeManager.Exclude(uc);
        }
    }
Beispiel #17
0
    // Update is called once per frame
    void Update()
    {
        Vector3 dirToTarget = toIntersection.position - transform.position;

        dirToTarget.y = 0;

        if (transform.position.y > 0)
        {
            transform.Translate(Vector3.up * gravity * Time.deltaTime);
            if (transform.position.y < 0)
            {
                Vector3 pos = transform.position;
                pos.y = 0;
                transform.position = pos;
            }
        }
        else
        {
            if (!enabledTurret)
            {
                transform.Find("Turret").GetComponent <TankTurret>().enabled = true;
                enabledTurret = true;

                GameObject para = transform.Find("parachute").gameObject;                //.parent = null;
                para.transform.parent = null;
                SelfDestruct dest = para.AddComponent <SelfDestruct>();
                dest.afterLife      = 5;
                dest.timer          = 0;
                dest.disappearSpeed = 5;
            }

            if (dirToTarget.magnitude < minRange)
            {
                FindNewIntersection();
            }
            else
            {
                Quaternion targetRotation = Quaternion.LookRotation(dirToTarget);
                float      angle          = Quaternion.Angle(transform.rotation, targetRotation);

                if (angle > 0)
                {
                    transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, turnRate * Time.deltaTime);
                }
                else
                {
                    transform.Translate(Vector3.forward * speed * Time.deltaTime);
                }
            }
        }
    }
Beispiel #18
0

        
Beispiel #19
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (cloneEffectFLash == null && collision.gameObject.layer.ToString() == "11") //skill
     {
         HP--;
         if (HP == 0)
         {
             selfDestruct = GameObject.Instantiate(selfDestruct);
             selfDestruct.transform.position = this.gameObject.transform.position;
             GameObject.Destroy(this.gameObject);
         }
         if (HP > 0)
         {
             cloneEffectFLash = GameObject.Instantiate(effectPlash);
             cloneEffectFLash.SetTimeMax(2);
             cloneEffectFLash.SetSpriteRender(this.gameObject.GetComponent <SpriteRenderer>());
             cloneEffectFLash.Active();
         }
     }
 }
Beispiel #20
0
    IEnumerator WaitAndDestroy()
    {
        yield return(new WaitForSeconds(weaponUseTime));

        CameraShake.Shake();
        for (int x = -1; x <= 1; x++)
        {
            for (int y = -1; y <= 1; y++)
            {
                if (x != 0 && y != 0)
                {
                    continue;
                }

                GameObject   obj          = SimplePool.Spawn(bombEffectPrefab, transform.position + Vector3.right * x + Vector3.up * y, Quaternion.identity);
                SelfDestruct selfDestruct = obj.GetComponent <SelfDestruct>();
                selfDestruct.selfDestructTime = damageDurationTime;
            }
        }
        OnWeaponUsed?.Invoke(this);
        SimplePool.Despawn(gameObject);
    }
Beispiel #21
0
    public override void OnInspectorGUI()
    {
        sd = (SelfDestruct)target;

        //DrawDefaultInspector();

        int mode = (int)sd.mode;

        cont  = new GUIContent("Type:", "Delay mode used");
        contL = new GUIContent[modeLabel.Length];
        for (int i = 0; i < contL.Length; i++)
        {
            contL[i] = new GUIContent(modeLabel[i], modeTooltip[i]);
        }
        mode    = EditorGUILayout.IntPopup(cont, mode, contL, intVal);
        sd.mode = (_DelayMode)mode;

        if (sd.mode == _DelayMode.RealTime)
        {
            cont     = new GUIContent("Delay:", "The delay in second before the gameObject is destroyed");
            sd.delay = EditorGUILayout.FloatField(cont, sd.delay);
        }
        else if (sd.mode == _DelayMode.Round)
        {
            cont     = new GUIContent("Round:", "The number of round before the gameObject is destroyed");
            sd.round = EditorGUILayout.IntField(cont, sd.round);
        }
        else if (sd.mode == _DelayMode.Turn)
        {
            cont    = new GUIContent("Turn:", "The number of turn before the gameObject is destroyed");
            sd.turn = EditorGUILayout.IntField(cont, sd.turn);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(sd);
        }
    }
Beispiel #22
0
    private void Start()
    {
        health = maxHealth;
        es     = GetComponent <EnemyStates>();
        nma    = GetComponent <NavMeshAgent>();
        sr     = GetComponent <SpriteRenderer>();
        bc     = GetComponent <BoxCollider>();
        sd     = GetComponent <SelfDestruct>();

        sd.enabled = false;

        GameObject gameControllerObjext = GameObject.FindWithTag("GameController");

        if (gameControllerObjext != null)
        {
            floor = gameControllerObjext.GetComponent <Floor>();
        }
        if (floor == null)
        {
            Debug.Log("Cannot find 'Floor' script");
        }
        notUpdated = true;
    }
Beispiel #23
0
    public void Show()
    {
        if (currentShownState)
        {
            Debug.LogError("Already Shown!", this);
            return;
        }

        if (autoAssignGlobalProperties)
        {
            GetProperties();
        }

        if (dialogProperties == null || !dialogProperties.Validate())
        {
            Debug.LogError("No or broken DialogProperties attached!", this);
            return;
        }

        currentShownState = true;
        dialogProperties.player.LockPlayer();

        if (currentlyShownObjects.IsNullOrEmpty())
        {
            currentlyShownObjects = new List <SelfDestruct>();
        }
        else
        {
            Hide();
        }

        if (currentlyShownMessages == null)
        {
            currentlyShownMessages = new List <DialogMessage>();
        }

        currentlyShownMessages.Add(this);

        GameObject    textObject    = Instantiate(dialogProperties.textPrefab, gameObject.transform);
        RectTransform textTransform = textObject.GetComponent <RectTransform>();
        TMP_Text      tmProText     = textObject.GetComponentInChildren <TMP_Text>();
        SelfDestruct  textDestruct  = textObject.AddComponent <SelfDestruct>();

        if (textObject == null)
        {
            Debug.LogError("Cannot create text GameObject!", this);
            return;
        }

        if (textTransform == null)
        {
            Debug.LogError("No RectTransform on Prefab!", this);
            return;
        }

        if (tmProText == null)
        {
            Debug.LogError("No TMP_Text on Prefab!", this);
            return;
        }

        if (textDestruct == null)
        {
            Debug.LogError("Cannot create SelfDestruct on text!", this);
            return;
        }

        tmProText.text = text;
        textTransform.SetPositionX(dialogProperties.textPosition.x);
        textTransform.SetPositionY(dialogProperties.textPosition.y);

        currentlyShownObjects.Add(textDestruct);


        int currentNumber = 0;

        foreach (DialogOption dialogOption in options)
        {
            float yPosition = dialogProperties.optionsOrigin.y - ((dialogProperties.optionsOffset * (options.Count - 1)) / 2) + (dialogProperties.optionsOffset * (float)(currentNumber++));

            GameObject    optionObject    = Instantiate(dialogProperties.buttonPrefab, gameObject.transform);
            RectTransform optionTransform = optionObject.GetComponent <RectTransform>();
            TMP_Text      optionText      = optionObject.GetComponentInChildren <TMP_Text>();
            DialogButton  dialogButton    = optionObject.GetComponentInChildren <DialogButton>();
            SelfDestruct  optionDestruct  = optionObject.AddComponent <SelfDestruct>();

            if (optionObject == null)
            {
                Debug.LogError("Cannot create Options GameObject!", this);
            }
            else if (optionTransform == null)
            {
                Debug.LogError("No RectTransform on Prefab!", this);
            }
            else if (optionText == null)
            {
                Debug.LogError("No TMP_Text on Prefab!", this);
            }
            else if (dialogButton == null)
            {
                Debug.LogError("No DialogButton on Prefab!", this);
            }
            else if (optionDestruct == null)
            {
                Debug.LogError("Cannot add SelfDestruct to Option!", this);
            }
            else
            {
                dialogButton.parentMessage = this;
                dialogButton.dialogOption  = dialogOption;
                optionText.text            = dialogOption.optionName;
                optionTransform.SetPositionX(dialogProperties.optionsOrigin.x);
                optionTransform.SetPositionY(yPosition);

                currentlyShownObjects.Add(optionDestruct);
            }
        }

        if (playSoundOnShow && soundSourcePlayer != null)
        {
            soundSourcePlayer.Play();
        }

        if (triggerUnityEventOnShow && unityEvent != null)
        {
            unityEvent.Invoke();
        }
    }
Beispiel #24
0
 public void Exit(Enemy enemy)
 {
     WaveManager.enemyCount--;
     SelfDestruct.Destroy(enemy.gameObject);
 }
Beispiel #25
0
 override public void SelfDestruct()
 {
     selfDestruct = GameObject.Instantiate(selfDestruct);
     selfDestruct.transform.position = this.gameObject.transform.position;
     GameObject.Destroy(this.gameObject);
 }
Beispiel #26
0
 void Start()
 {
     selfDestruct             = this.GetComponent <SelfDestruct>();
     selfDestruct.onDestruct += OnDestructHandler;
 }
        static int Main(string[] args)
        {
            ConsoleColor normalColor  = ConsoleColor.Green;
            ConsoleColor warningColor = ConsoleColor.White;
            ConsoleColor errorColor   = ConsoleColor.Yellow;

            try
            {
                Console.SetWindowSize(80, 30);
                Console.BackgroundColor = ConsoleColor.Black;
                Console.ForegroundColor = normalColor;
            }
            catch { /* DO NOTHING */ }

            Console.WriteLine("Creating Shortcut ...");
            Console.WriteLine();

            // force the use of static arguments
            if (args.Length == 0)
            {
                // give the progie some args to work with
                Console.WriteLine("Using Internal Static Arguments for RocksmithToolkitGUI ...");
                Console.WriteLine();
                args = new string[]
                {
                    "RocksmithToolkitGUI.lnk",
                    "./RocksmithToolkit/RocksmithToolkitGUI.exe",
                    "./RocksmithToolkit/songcreator.ico",
                    "0"
                };
            }

            if (args.Length < 2)
            {
                args = new string[] { "?" }
            }
            ;
            if (args[0].Contains("?") || args[0].ToLower().Contains("help"))
            {
                Console.WriteLine(@" - CLI: CreateShortcut.exe");
                Console.WriteLine(@" - Version: " + ProjectVersion());
                Console.WriteLine();
                Console.WriteLine(@" - Purpose: Creates a shortcut for a file based on its relative path");
                Console.WriteLine();
                Console.WriteLine(@" - Command Line Usage: CreateShortcut [arg1] [arg2] [arg3] [arg4]");
                Console.WriteLine();
                Console.WriteLine(@" - Where: [arg1] shortcut relative path, e.g. 'myshortcut.lnk'");
                Console.WriteLine(@"          [arg2] application relative path, e.g. './programs/myshortcut.exe'");
                Console.WriteLine(@"          [arg3] icon relative path, e.g. './programs/myshortcut.ico'");
                Console.WriteLine(@"          [arg4] icon index, e.g. '0'");
                Console.WriteLine();
                Console.WriteLine(@" - Note: The paths are relative to location of CreateShortcut.exe");
                Console.WriteLine(@"         CreateToolkitShortcut.exe self destructs after sucessful completion");
                Console.WriteLine();
                Console.WriteLine(@"Press any key to continue ...");
                Console.Read();
                return(0);
            }

            FileInfo save = null, app = null, icon = null;
            int      iconindex = 0;
            int      result    = 0; // completed sucessfully

            switch (args.Length)
            {
            case 2:
                save = new FileInfo(args[0]);
                app  = new FileInfo(args[1]);
                if (!app.Exists)
                {
                    Console.ForegroundColor = warningColor;
                    Console.WriteLine("<WARNING> [arg2] application to launch not found.");
                    Console.WriteLine();
                    Console.ForegroundColor = normalColor;
                    result = 2;
                }
                break;

            case 3:
                icon = new FileInfo(args[2]);

                if (!icon.Exists)
                {
                    try
                    {
                        iconindex = Convert.ToInt32(args[2]);
                    }
                    catch
                    {
                        Console.ForegroundColor = warningColor;
                        Console.WriteLine("<WARNING> [arg3] is not a valid index or file,");
                        Console.WriteLine("          assuming index 0 in application file.");
                        Console.WriteLine();
                        Console.ForegroundColor = normalColor;
                        result = 3;
                    }
                }
                goto case 2;

            case 4:
                try
                {
                    iconindex = Convert.ToInt32(args[3]);
                }
                catch
                {
                    Console.ForegroundColor = warningColor;
                    Console.WriteLine("<WARNING> [arg4] is not a valid index,");
                    Console.WriteLine("          assuming index 0.");
                    Console.WriteLine();
                    Console.ForegroundColor = normalColor;
                    result = 4;
                }
                goto case 3;
            }

            if (save != null && app != null && (result == 0 || result > 2))
            {
                ShellShortcut shortcut = new ShellShortcut(save.FullName);
                shortcut.WorkingDirectory = app.DirectoryName;
                shortcut.Path             = app.FullName;

                if (icon != null && icon.Exists)
                {
                    shortcut.IconPath = icon.FullName;
                }
                else
                {
                    shortcut.IconPath = app.FullName;
                }

                shortcut.IconIndex = iconindex;
                shortcut.Save();

                Console.WriteLine();
                Console.WriteLine(@"Sucessfully Creating Shortcut ...");
            }

            Console.WriteLine();
            Console.WriteLine(@" - [arg1] shortcut relative path: " + args[0]);
            Console.WriteLine(@" - [arg2] application relative path: " + args[1]);
            Console.WriteLine(@" - [arg3] icon relative path: " + args[2]);
            Console.WriteLine(@" - [arg4] icon index: " + args[3]);
            Console.WriteLine();

            // pause
            if (result != 0)
            {
                if (args[1] == "./RocksmithToolkit/RocksmithToolkitGUI.exe")
                {
                    Console.ForegroundColor = errorColor;
                    Console.WriteLine("<ERROR> Create Toolkit Shortcut Failed ...");
                    Console.WriteLine();
                    Console.WriteLine(@" - Put the 'CreateToolkitShortcut.exe' file into the root folder");
                    Console.WriteLine(@"   of 'RocksmithToolkit' subfolder, and run it from there");
                    Console.WriteLine();
                    Console.ForegroundColor = normalColor;
                }

                Console.WriteLine(@"Press any key to continue ...");
                Console.Read();
                return(result);
            }

            SelfDestruct.DoIt();
            return(result);
        }
Beispiel #28
0
        protected override void Apply(AttributeLoader loader, object wrapperObj)
        {
            if (!(wrapperObj is AbilityAttributesWrapper w))
            {
                throw new System.InvalidCastException();
            }

            if (Resource1Cost != null || Resource2Cost != null || Resource1CostMult != null || Resource2CostMult != null)
            {
                var w2 = new CostAttributesWrapper(w.Cost);

                loader.ApplyPPatch(Resource1Cost, () => w2.Resource1Cost);
                loader.ApplyPMultPatch(Resource1CostMult, () => w2.Resource1Cost);

                loader.ApplyPPatch(Resource2Cost, () => w2.Resource2Cost);
                loader.ApplyPMultPatch(Resource2CostMult, () => w2.Resource2Cost);

                w.Cost = w2;
            }

            loader.ApplyPPatch(EdgeOfTargetShapeMinDistance, () => w.EdgeOfTargetShapeMinDistance, Fixed64.UnsafeFromDouble);
            loader.ApplyPMultPatch(EdgeOfTargetShapeMinDistanceMult, () => w.EdgeOfTargetShapeMinDistance);

            loader.ApplyPPatch(CooldownTimeSecs, () => w.CooldownTimeSecs, Fixed64.UnsafeFromDouble);
            loader.ApplyPMultPatch(CooldownTimeSecsMult, () => w.CooldownTimeSecs);

            loader.ApplyPPatch(WarmupTimeSecs, () => w.WarmupTimeSecs, Fixed64.UnsafeFromDouble);
            loader.ApplyPMultPatch(WarmupTimeSecsMult, () => w.WarmupTimeSecs);

            loader.ApplyPPatch(SharedCooldownChannel, () => w.SharedCooldownChannel);
            loader.ApplyPMultPatch(SharedCooldownChannelMult, () => w.SharedCooldownChannel);

            loader.ApplyPPatch(AbilityType, () => w.AbilityType);
            loader.ApplyPPatch(TargetingType, () => w.TargetingType);
            loader.ApplyPPatch(TargetAlignment, () => w.TargetAlignment);
            loader.ApplyPPatch(AbilityMapTargetLayers, () => w.AbilityMapTargetLayers);
            loader.ApplyPPatch(GroundAutoTargetAlignment, () => w.GroundAutoTargetAlignment);
            loader.ApplyPPatch(CasterMovesToTarget, () => w.CasterMovesToTarget);
            loader.ApplyPPatch(GroupActivationType, () => w.GroupActivationType);
            loader.ApplyPPatch(StartsRemovedInGameMode, () => w.StartsRemovedInGameMode);
            loader.ApplyPPatch(SkipCastOnArrivalConditions, () => w.SkipCastOnArrivalConditions);
            loader.ApplyPPatch(IsToggleable, () => w.IsToggleable);
            loader.ApplyPPatch(CastOnDeath, () => w.CastOnDeath);

            if (TargetHighlighting != null)
            {
                using (loader.logger.BeginScope($"TargetHighlighting:"))
                {
                    var w2 = new TargetHighlightingAttributesWrapper(w.TargetHighlighting);
                    TargetHighlighting.Apply(loader, w2, null);
                    w.TargetHighlighting = w2;
                }
            }
            if (Charges != null)
            {
                using (loader.logger.BeginScope($"Charges:"))
                {
                    var w2 = new ChargeAttributesWrapper(w.Charges);
                    Charges.Apply(loader, w2, null);
                    w.Charges = w2;
                }
            }
            if (Autocast != null)
            {
                using (loader.logger.BeginScope($"Autocast:"))
                {
                    var w2 = new AutocastAttributesWrapper(w.Autocast);
                    Autocast.Apply(loader, w2, null);
                    w.Autocast = w2;
                }
            }
            if (ProduceUnit != null)
            {
                using (loader.logger.BeginScope($"ProduceUnit:"))
                {
                    var w2 = new ProduceUnitAttributesWrapper(w.ProduceUnit);
                    ProduceUnit.Apply(loader, w2, null);
                    w.ProduceUnit = w2;
                }
            }
            if (UseWeapon != null)
            {
                using (loader.logger.BeginScope($"UseWeapon:"))
                {
                    var w2 = new UseWeaponAttributesWrapper(w.UseWeapon);
                    UseWeapon.Apply(loader, w2, null);
                    w.UseWeapon = w2;
                }
            }
            if (ChangeContext != null)
            {
                var w2 = new ChangeContextAttributesWrapper(w.ChangeContext);
                loader.ApplyPPatch(ChangeContext, () => w2.TargetContext);
                w.ChangeContext = w2;
            }
            if (AirSortie != null)
            {
                using (loader.logger.BeginScope($"AirSortie:"))
                {
                    var w2 = new AirSortieAttributesWrapper(w.AirSortie);
                    AirSortie.Apply(loader, w2, null);
                    w.AirSortie = w2;
                }
            }
            if (Salvage != null)
            {
                using (loader.logger.BeginScope($"Salvage:"))
                {
                    var w2 = new SalvageAttributesWrapper(w.Salvage);
                    Salvage.Apply(loader, w2, null);
                    w.Salvage = w2;
                }
            }
            if (ApplyStatusEffect.Count > 0)
            {
                using (loader.logger.BeginScope($"ApplyStatusEffect:"))
                {
                    var w2 = new ApplyStatusEffectAttributesWrapper(w.ApplyStatusEffect);

                    var statusEffectWrappers = w2.StatusEffectsToApply?.Select(x => new StatusEffectAttributesWrapper(x)).ToList() ?? new List <StatusEffectAttributesWrapper>();
                    loader.ApplyNamedLPatch(ApplyStatusEffect, statusEffectWrappers, (x) => new StatusEffectAttributesWrapper(x), nameof(StatusEffectAttributes));
                    w2.StatusEffectsToApply = statusEffectWrappers.ToArray();

                    w.ApplyStatusEffect = w2;
                }
            }
            if (Repair != null)
            {
                var w2 = new RepairAttributesWrapper(w.Repair);
                loader.ApplyPPatch(Repair, () => w2.WeaponID);
                w.Repair = w2;
            }
            if (SelfDestruct != null)
            {
                using (loader.logger.BeginScope($"SelfDestruct:"))
                {
                    var w2 = new SelfDestructAttributesWrapper(w.SelfDestruct);
                    SelfDestruct.Apply(loader, w2, null);
                    w.SelfDestruct = w2;
                }
            }
            if (ModifyInventory != null)
            {
                using (loader.logger.BeginScope($"ModifyInventory:"))
                {
                    var w2 = new ModifyInventoryAttributesWrapper(w.ModifyInventory);
                    ModifyInventory.Apply(loader, w2, null);
                    w.ModifyInventory = w2;
                }
            }
            if (RequiredResearch != null)
            {
                var w2 = new ResearchDependenciesAttributesWrapper(w.ResearchDependencies);
                loader.ApplyArrayPropertyPatch(RequiredResearch, w2, "RequiredResearch");
                w.ResearchDependencies = w2;
            }
            if (ActivationDependencies != null)
            {
                using (loader.logger.BeginScope($"ActivationDependencies:"))
                {
                    var w2 = new ActivationDependenciesAttributesWrapper(w.ActivationDependencies);
                    ActivationDependencies.Apply(loader, w2, null);
                    w.ActivationDependencies = w2;
                }
            }
            if (AutoToggleOffConditions != null)
            {
                using (loader.logger.BeginScope($"AutoToggleOffConditions:"))
                {
                    var w2 = new AutoToggleOffConditionsAttributesWrapper(w.AutoToggleOffConditions);
                    AutoToggleOffConditions.Apply(loader, w2, null);
                    w.AutoToggleOffConditions = w2;
                }
            }
            if (ChainCasting != null)
            {
                using (loader.logger.BeginScope($"ChainCasting:"))
                {
                    var w2 = new ChainCastingAttributesWrapper(w.ChainCasting);
                    ChainCasting.Apply(loader, w2, null);
                    w.ChainCasting = w2;
                }
            }
        }