protected static void ReplaceComponent(Door door) { if (door.GetComponent <DoorPortalComponentEx>() != null) { return; } if (door.GetComponent <Turnstile.TurnstileDoorPortalComponent>() != null) { return; } if (door.GetComponent <MysteriousDeviceDoor.MysteriousDoorPortalComponent>() != null) { return; } Door.DoorPortalComponent oldComponent = door.PortalComponent as Door.DoorPortalComponent; door.RemoveComponent <Door.DoorPortalComponent>(); ObjectComponents.AddComponent <DoorPortalComponentEx>(door, new object[0]); if (oldComponent != null) { Door.DoorPortalComponent newComponent = door.PortalComponent as Door.DoorPortalComponent; if (newComponent != null) { newComponent.OwnerDoor = oldComponent.OwnerDoor; } } }
public void OnExitBuildBuy(Lot lot) { foreach (AncientPortal portal in lot.GetObjects <AncientPortal>()) { if (portal.PortalComponent == null) { ObjectComponents.AddComponent <AncientPortalComponent>(portal, new object[0]); } } }
public void OnWorldLoadFinished() { foreach (AncientPortal portal in Sims3.Gameplay.Queries.GetObjects <AncientPortal>()) { if (portal.PortalComponent == null) { ObjectComponents.AddComponent <AncientPortalComponent>(portal, new object[0]); } } }
public Enemy(GameScreen gameScreen) : base(gameScreen) { HitBox hitBox = new HitBox(this); BoxCollider collider = new BoxCollider(); collider.Size = new Vector2(17, 40); collider.Offset = new Vector2(-10, -16); hitBox.SetCollider(collider); AddComponent(hitBox); Physics physics = new Physics(this); AddComponent(physics); physics.Solid = true; physics.GravityEnabled = true; Sprite sprite = new Sprite(this); AddComponent(sprite); sprite.SpriteOffset = new Vector2(-24, -24); sprite.AddTexture(gameScreen.Content, "Images/Sprites/Enemy/gravling"); Dialogue dialogue = new Dialogue(this); DialogueBranch dialogueBranch = new DialogueBranch(dialogue); dialogue.AddDialogueBranch("", dialogueBranch); DialogueBox dialogueBox = new DialogueBox(dialogueBranch); dialogueBranch.AddDialogueBox(dialogueBox); dialogueBox.skipable = true; dialogueBox.textSpeed = 0.01f; dialogueBox.SetText("Satans POTATis!\nMy name jefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); DialogueBox dialogueBox2 = new DialogueBox(dialogueBranch); dialogueBox2.skipable = true; dialogueBranch.AddDialogueBox(dialogueBox2); dialogueBox2.textSpeed = .5f; dialogueBox2.SetText("lmao lmao lmao lmao lmao lmao\nlmao lmao lmao lmao lmao lmao\nlmao lmao lmao lmao lmao lmao"); ObjectComponents.Add(dialogue); HP = 200; }
protected static void ReplaceComponent(Sim sim) { if (sim.GetComponent <SimRoutingComponentEx>() != null) { return; } SimRoutingComponent oldComponent = sim.SimRoutingComponent; sim.RemoveComponent <SimRoutingComponent>(); ObjectComponents.AddComponent <SimRoutingComponentEx>(sim, new object[0]); if (oldComponent != null) { SimRoutingComponent newComponent = sim.SimRoutingComponent; if (newComponent != null) { newComponent.mWalkStyleRequests = oldComponent.mWalkStyleRequests; newComponent.mSimWalkStyle = oldComponent.mSimWalkStyle; } } }
protected override bool PrePerform(GameObject obj, bool postLoad) { if (obj.InInventory) { Inventory inventory = Inventory.ParentInventory(obj); if (inventory != null) { if (inventory.Owner == null) { ErrorTrap.AddToBeDeleted(obj, true); LogCorrection("Corrupt Inventory Object Deleted: " + ErrorTrap.GetName(obj)); } } } if (obj.Inventory != null) { Inventories.CheckInventory(LogCorrection, DebugLogCorrection, ErrorTrap.GetName(obj), obj.Inventory, false); } ObjectComponents.Cleanup(obj, DebugLogCorrection); return(true); }
public static bool ResetObject(IGameObject obj, bool resetAll) { try { if (obj is Sim) { ResetSim(obj as Sim, resetAll); } else if (obj is Lot) { ResetLot(obj as Lot, resetAll); } else { if (resetAll) { if (MasterController.Settings.IsExcludedLot(obj.LotCurrent)) { return(false); } } GameObject gameObj = obj as GameObject; if (gameObj != null) { ObjectComponents.Cleanup(gameObj, null); foreach (Sim sim in new List <Sim>(gameObj.mReferenceList)) { try { if ((sim != null) && !sim.HasBeenDestroyed) { sim.InteractionQueue.PurgeInteractions(gameObj); } } catch (Exception e) { Common.DebugException(sim, e); } } } bool success = false; /* * if (obj.InInventory) * { * obj.RemoveFromWorld(); * obj.AddToWorld(); * obj.SetHiddenFlags(HiddenFlags.Nothing); * obj.SetOpacity(1f, 0f); * } */ foreach (ICustomReset reset in Common.DerivativeSearch.Find <ICustomReset>()) { if (reset.Perform(obj)) { success = true; break; } } if (!success) { obj.SetObjectToReset(); } } return(true); } catch (Exception exception) { Common.Exception(obj, exception); return(false); } }