static bool Prefix(CrashHome __instance) { __instance.crashPrefab = null; __instance.spawnTime = 1f; return(true); }
static void Postfix(CrashHome __instance) { SafeAnimator.SetBool(__instance.animator, "attacking", true); __instance.spawnTime = -1f; __instance.gameObject.AddComponent <Destructor>(); }
/** * Wait for some time so the CrashHome can load and spawn the Crash fish. * If we try to manually spawn the crash fish (and assign to the CrashHome) it will be at * the wrong orientation. Maybe someone can figure out why this happens to we can create * it without leveraging this hack. */ private IEnumerator WaitToAssignId(NitroxId id, CrashHome crashHome) { yield return(new WaitForSeconds(0.25f)); GameObject crash = ((Crash)crashHome.ReflectionGet("crash")).gameObject; NitroxIdentifier.SetNewId(crash, id); }
/** * Crash fish are spawned by the CrashHome in the Monobehaviours Start method */ public Optional <GameObject> Spawn(Entity entity, Optional <GameObject> parent) { if (parent.IsPresent()) { CrashHome crashHome = parent.Get().GetComponent <CrashHome>(); LargeWorldStreamer.main.StartCoroutine(WaitToAssignGuid(entity.Guid, crashHome)); } return(Optional <GameObject> .Empty()); }
/** * Crash fish are spawned by the CrashHome in the Monobehaviours Start method */ public Optional <GameObject> Spawn(Entity entity, Optional <GameObject> parent, EntityCell cellRoot) { if (parent.IsPresent()) { CrashHome crashHome = parent.Get().GetComponent <CrashHome>(); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(crashHome.crashPrefab, Vector3.zero, Quaternion.Euler(-90f, 0f, 0f)); gameObject.transform.SetParent(crashHome.transform, false); NitroxEntity.SetNewId(gameObject, entity.Id); ReflectionHelper.ReflectionSet <CrashHome>(crashHome, "crash", gameObject.GetComponent <Crash>()); } return(Optional <GameObject> .Empty()); }
/** * Crash fish are spawned by the CrashHome in the Monobehaviours Start method */ public Optional <GameObject> Spawn(Entity entity, Optional <GameObject> parent, EntityCell cellRoot) { if (parent.HasValue) { CrashHome crashHome = parent.Value.GetComponent <CrashHome>(); GameObject gameObject = Object.Instantiate(crashHome.crashPrefab, Vector3.zero, Quaternion.Euler(-90f, 0f, 0f)); gameObject.transform.SetParent(crashHome.transform, false); NitroxEntity.SetNewId(gameObject, entity.Id); crashHome.crash = gameObject.GetComponent <Crash>(); } return(Optional.Empty); }
static void Postfix(CrashHome __instance) { //rebreather var rebreatherTechData = CraftDataHandler.GetTechData(TechType.Rebreather); rebreatherTechData.Ingredients.Add(new Ingredient(TechType.RadiationHelmet, 1)); CraftDataHandler.SetTechData(TechType.Rebreather, rebreatherTechData); //reinforcedSuit var reinforcedSuitTechData = CraftDataHandler.GetTechData(TechType.ReinforcedDiveSuit); reinforcedSuitTechData.Ingredients.Add(new Ingredient(TechType.RadiationSuit, 1)); reinforcedSuitTechData.Ingredients.Add(new Ingredient(TechType.RadiationGloves, 1)); CraftDataHandler.SetTechData(TechType.ReinforcedDiveSuit, reinforcedSuitTechData); }
/** * Wait for the next fixed update so the CrashHome can load and spawn the Crash fish. * If we try to manually spawn the crash fish (and assign to the CrashHome) it will be at * the wrong orientation. Maybe someone can figure out why this happens to we can create * it without leveraging this hack. */ private IEnumerator WaitToAssignGuid(string guid, CrashHome crashHome) { yield return(new WaitForFixedUpdate()); ((Crash)crashHome.ReflectionGet("crash")).gameObject.SetNewGuid(guid); }