コード例 #1
0
 public static void Postfix(PilotableActorRepresentation __instance, VisibilityLevel newLevel)
 {
     try {
         Log.LogWrite("PilotableActorRepresentation.OnPlayerVisibilityChanged " + __instance.parentCombatant.DisplayName + " " + newLevel + "\n");
         if (__instance.parentActor == null)
         {
             Log.LogWrite(" are you f*****g seriously?? parentActor is null\n", true);
             return;
         }
         foreach (MechComponent component in __instance.parentActor.allComponents)
         {
             try {
                 ActivatableComponent activatable = component.componentDef.GetComponent <ActivatableComponent>();
                 if (activatable == null)
                 {
                     continue;
                 }
                 ;
                 if ((activatable.activateVFXOutOfLOSHide == false) && (activatable.presistantVFXOutOfLOSHide == false))
                 {
                     continue;
                 }
                 if (activatable.activateVFXOutOfLOSHide == true)
                 {
                     ObjectSpawnDataSelf activeVFX = component.ActivateVFX();
                     if (activeVFX != null)
                     {
                         if (newLevel != VisibilityLevel.LOSFull)
                         {
                             activeVFX.Hide();
                         }
                         else
                         {
                             activeVFX.Show();
                         }
                     }
                 }
                 if (activatable.presistantVFXOutOfLOSHide == true)
                 {
                     ObjectSpawnDataSelf presistantVFX = component.PresitantVFX();
                     if (presistantVFX != null)
                     {
                         if (newLevel != VisibilityLevel.LOSFull)
                         {
                             presistantVFX.Hide();
                         }
                         else
                         {
                             presistantVFX.Show();
                         }
                     }
                 }
             } catch (Exception e) {
                 Log.LogWrite(e.ToString() + "\n", true);
             }
         }
     }catch (Exception e) {
         Log.LogWrite(e.ToString() + "\n", true);
     }
 }
コード例 #2
0
        public VFXObjects(MechComponent p)
        {
            this.parent = p;
            ActivatableComponent activatable = this.parent.componentDef.GetComponent <ActivatableComponent>();

            if (activatable != null)
            {
                GameObject parentObject = p.parent.GameRep.gameObject;
                Weapon     weapon       = p as Weapon;
                if (weapon != null)
                {
                    if (weapon.weaponRep != null)
                    {
                        parentObject = weapon.weaponRep.gameObject;
                    }
                }
                Log.LogWrite(p.defId + " is activatable \n");
                if (activatable.presistantVFX.isInited)
                {
                    try {
                        Log.LogWrite(p.defId + " spawning " + activatable.presistantVFX.VFXPrefab + " \n");
                        presitantObject = new ObjectSpawnDataSelf(activatable.presistantVFX.VFXPrefab, parentObject,
                                                                  new Vector3(activatable.presistantVFX.VFXOffsetX, activatable.presistantVFX.VFXOffsetY, activatable.presistantVFX.VFXOffsetZ),
                                                                  new Vector3(activatable.presistantVFX.VFXScaleX, activatable.presistantVFX.VFXScaleY, activatable.presistantVFX.VFXScaleZ), true, false);
                        presitantObject.SpawnSelf(parent.parent.Combat);
                    } catch (Exception e) {
                        Log.LogWrite(" Fail to spawn vfx " + e.ToString() + "\n");
                    }
                }
                else
                {
                    presitantObject = null;
                }
                if (activatable.activateVFX.isInited)
                {
                    Log.LogWrite(p.defId + " spawning " + activatable.activateVFX.VFXPrefab + " \n");
                    activateObject = new ObjectSpawnDataSelf(activatable.activateVFX.VFXPrefab, parentObject,
                                                             new Vector3(activatable.activateVFX.VFXOffsetX, activatable.activateVFX.VFXOffsetY, activatable.activateVFX.VFXOffsetZ),
                                                             new Vector3(activatable.activateVFX.VFXScaleX, activatable.activateVFX.VFXScaleY, activatable.activateVFX.VFXScaleZ), true, false);
                }
                else
                {
                    activateObject = null;
                }
                if (activatable.destroyedVFX.isInited)
                {
                    Log.LogWrite(p.defId + " spawning " + activatable.destroyedVFX.VFXPrefab + " \n");
                    destroyedObject = new ObjectSpawnDataSelf(activatable.destroyedVFX.VFXPrefab, parentObject,
                                                              new Vector3(activatable.destroyedVFX.VFXOffsetX, activatable.destroyedVFX.VFXOffsetY, activatable.destroyedVFX.VFXOffsetZ),
                                                              new Vector3(activatable.destroyedVFX.VFXScaleX, activatable.destroyedVFX.VFXScaleY, activatable.destroyedVFX.VFXScaleZ), true, false);
                }
                else
                {
                    destroyedObject = null;
                }
            }
        }
コード例 #3
0
 public static void Postfix(MechComponent __instance, WeaponHitInfo hitInfo, ComponentDamageLevel damageLevel, bool applyEffects)
 {
     try {
         Log.Debug?.TWL(0, "MechComponent.DamageComponent Postfix " + __instance.defId + " DamageLevel:" + __instance.DamageLevel + "/" + damageLevel);
         if ((__instance.DamageLevel >= ComponentDamageLevel.Destroyed) || (damageLevel >= ComponentDamageLevel.Destroyed))
         {
             Statistic isCAEDestroyed = __instance.StatCollection.GetStatistic("CAEDestroyed");
             if (isCAEDestroyed == null)
             {
                 isCAEDestroyed = __instance.StatCollection.AddStatistic("CAEDestroyed", false);
             }
             if (isCAEDestroyed.Value <bool>() == false)
             {
                 isCAEDestroyed.SetValue(true);
                 Log.Debug?.WL(1, "really destroyed at first time");
                 ActivatableComponent activatable = __instance.componentDef.GetComponent <ActivatableComponent>();
                 if (activatable == null)
                 {
                     Log.Debug?.WL(1, "not activatable");
                     return;
                 }
                 ObjectSpawnDataSelf VFX = __instance.PresitantVFX();
                 if (VFX != null)
                 {
                     VFX.CleanupSelf();
                 }
                 ;
                 VFX = __instance.ActivateVFX();
                 if (VFX != null)
                 {
                     VFX.CleanupSelf();
                 }
                 ;
                 VFX = __instance.DestroyedVFX();
                 if (VFX != null)
                 {
                     VFX.SpawnSelf(__instance.parent.Combat);
                 }
                 ;
                 if (activatable.ExplodeOnDamage)
                 {
                     __instance.AoEExplodeComponent();
                 }
                 ;
                 __instance.playDestroySound();
             }
             else
             {
                 Log.Debug?.WL(1, "not a really destroyed");
             }
             __instance.UpdateAuras();
         }
     } catch (Exception e) {
         Log.Debug?.TWL(0, e.ToString(), true);
     }
 }
コード例 #4
0
 public static void Postfix(MechComponent __instance, WeaponHitInfo hitInfo, ComponentDamageLevel damageLevel, bool applyEffects, ref bool __state)
 {
     if (__state)
     {
         ActivatableComponent activatable = __instance.componentDef.GetComponent <ActivatableComponent>();
         if (activatable == null)
         {
             Log.LogWrite(" not activatable\n");
             return;
         }
         ObjectSpawnDataSelf VFX = __instance.PresitantVFX();
         if (VFX != null)
         {
             VFX.CleanupSelf();
         }
         ;
         VFX = __instance.ActivateVFX();
         if (VFX != null)
         {
             VFX.CleanupSelf();
         }
         ;
         VFX = __instance.DestroyedVFX();
         if (VFX != null)
         {
             VFX.SpawnSelf(__instance.parent.Combat);
         }
         ;
         if (activatable.ExplodeOnDamage)
         {
             __instance.AoEExplodeComponent();
         }
         ;
         __instance.playDestroySound();
     }
     else
     {
         Log.LogWrite(" no additional processing\n");
     }
     __instance.UpdateAuras();
 }
コード例 #5
0
        public VFXObjects(MechComponent p)
        {
            this.parent        = p;
            this.explodeObject = null;
            ActivatableComponent activatable = this.parent.componentDef.GetComponent <ActivatableComponent>();

            if (activatable != null)
            {
                GameObject parentObject = p.parent.GameRep.gameObject;
                Weapon     weapon       = p as Weapon;
                if (weapon != null)
                {
                    if (weapon.weaponRep != null)
                    {
                        parentObject = weapon.weaponRep.gameObject;
                    }
                }
                Log.Debug?.Write(p.defId + " is activatable \n");
                //PilotableActorRepresentation rep = parent.parent.GameRep as PilotableActorRepresentation;
                if (activatable.presistantVFX.isInited)
                {
                    try {
                        Log.Debug?.Write(p.defId + " spawning " + activatable.presistantVFX.VFXPrefab + " \n");
                        presitantObject = new ObjectSpawnDataSelf(activatable.presistantVFX.VFXPrefab, parentObject,
                                                                  new Vector3(activatable.presistantVFX.VFXOffsetX, activatable.presistantVFX.VFXOffsetY, activatable.presistantVFX.VFXOffsetZ),
                                                                  new Vector3(activatable.presistantVFX.VFXScaleX, activatable.presistantVFX.VFXScaleY, activatable.presistantVFX.VFXScaleZ), true, false);
                        presitantObject.SpawnSelf(parent.parent.Combat);
                        //if(rep != null) {
                        //  if (activatable.presistantVFXOutOfLOSHide == true) {
                        //    if (rep.VisibleToPlayer == false) { presitantObject.Hide(); }
                        //  }
                        //}
                    } catch (Exception e) {
                        Log.Debug?.Write(" Fail to spawn vfx " + e.ToString() + "\n");
                    }
                }
                else
                {
                    presitantObject = null;
                }
                if (activatable.activateVFX.isInited)
                {
                    Log.Debug?.Write(p.defId + " spawning " + activatable.activateVFX.VFXPrefab + " \n");
                    activateObject = new ObjectSpawnDataSelf(activatable.activateVFX.VFXPrefab, parentObject,
                                                             new Vector3(activatable.activateVFX.VFXOffsetX, activatable.activateVFX.VFXOffsetY, activatable.activateVFX.VFXOffsetZ),
                                                             new Vector3(activatable.activateVFX.VFXScaleX, activatable.activateVFX.VFXScaleY, activatable.activateVFX.VFXScaleZ), true, false);
                }
                else
                {
                    activateObject = null;
                }
                if (activatable.destroyedVFX.isInited)
                {
                    Log.Debug?.Write(p.defId + " spawning " + activatable.destroyedVFX.VFXPrefab + " \n");
                    destroyedObject = new ObjectSpawnDataSelf(activatable.destroyedVFX.VFXPrefab, parentObject,
                                                              new Vector3(activatable.destroyedVFX.VFXOffsetX, activatable.destroyedVFX.VFXOffsetY, activatable.destroyedVFX.VFXOffsetZ),
                                                              new Vector3(activatable.destroyedVFX.VFXScaleX, activatable.destroyedVFX.VFXScaleY, activatable.destroyedVFX.VFXScaleZ), true, false);
                }
                else
                {
                    destroyedObject = null;
                }
            }
        }