public void ForceToFront() { effect.SetLayer((int)Grid.SceneLayer.BuildingFront); effect.SetSceneLayer(Grid.SceneLayer.BuildingFront);/* * var pos = effect.transform.localPosition; * pos.z = -0.5f; * effect.transform.SetLocalPosition(pos);*/ }
protected override void PositionOccupyingObject() { base.PositionOccupyingObject(); KBatchedAnimController component = base.occupyingObject.GetComponent <KBatchedAnimController>(); component.SetSceneLayer(Grid.SceneLayer.BuildingUse); KSelectable component2 = base.occupyingObject.GetComponent <KSelectable>(); if ((Object)component2 != (Object)null) { component2.IsSelectable = true; } }
private void PositionActiveEgg() { if ((bool)display_egg) { KBatchedAnimController component = display_egg.GetComponent <KBatchedAnimController>(); component.enabled = true; component.SetSceneLayer(Grid.SceneLayer.BuildingUse); KSelectable component2 = display_egg.GetComponent <KSelectable>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { component2.enabled = true; } tracker = display_egg.AddComponent <KBatchedAnimTracker>(); tracker.symbol = "snapto_egg"; } }
public FishFeederBot(Instance smi, float mass_per_ball, HashedString[] ball_symbols) { this.smi = smi; massPerBall = mass_per_ball; anim = GameUtil.KInstantiate(Assets.GetPrefab("FishFeederBot"), smi.transform.GetPosition(), Grid.SceneLayer.Front, null, 0).GetComponent <KBatchedAnimController>(); anim.transform.SetParent(smi.transform); anim.gameObject.SetActive(true); anim.SetSceneLayer(Grid.SceneLayer.Building); anim.Play("ball", KAnim.PlayMode.Once, 1f, 0f); anim.Stop(); foreach (HashedString hash in ball_symbols) { anim.SetSymbolVisiblity(hash, false); } Storage[] components = smi.gameObject.GetComponents <Storage>(); topStorage = components[0]; botStorage = components[1]; }
public static void SetSpawnNavType(GameObject inst) { int cell = Grid.PosToCell(inst); Navigator component = inst.GetComponent <Navigator>(); if ((Object)component != (Object)null) { if (Grid.IsSolidCell(cell)) { component.SetCurrentNavType(NavType.Solid); inst.transform.SetPosition(Grid.CellToPosCBC(cell, Grid.SceneLayer.FXFront)); KBatchedAnimController component2 = inst.GetComponent <KBatchedAnimController>(); component2.SetSceneLayer(Grid.SceneLayer.FXFront); } else { KBatchedAnimController component3 = inst.GetComponent <KBatchedAnimController>(); component3.SetSceneLayer(Grid.SceneLayer.Creatures); } } }
public static void DropAllCreatures(SMInstance smi) { Storage component = smi.master.GetComponent <Storage>(); if (!component.IsEmpty()) { List <GameObject> items = component.items; int count = items.Count; int cell = Grid.OffsetCell(Grid.PosToCell(smi.transform.GetPosition()), smi.master.spawnOffset); Vector3 position = Grid.CellToPosCBC(cell, Grid.SceneLayer.Creatures); for (int num = count - 1; num >= 0; num--) { GameObject gameObject = items[num]; component.Drop(gameObject, true); gameObject.transform.SetPosition(position); KBatchedAnimController component2 = gameObject.GetComponent <KBatchedAnimController>(); component2.SetSceneLayer(Grid.SceneLayer.Creatures); } smi.master.RefreshCreatureCount(null); } }
public void Unequip(Equippable equippable) { AssignableSlotInstance slot = GetSlot(equippable.slot); slot.Unassign(true); equippable.Trigger(-170173755, this); GameObject targetGameObject = GetTargetGameObject(); if ((bool)targetGameObject) { targetGameObject.Trigger(-1285462312, equippable.GetComponent <KPrefabID>()); KBatchedAnimController component = targetGameObject.GetComponent <KBatchedAnimController>(); if (!destroyed) { if ((Object)equippable.def.BuildOverride != (Object)null && (Object)component != (Object)null) { component.GetComponent <SymbolOverrideController>().TryRemoveBuildOverride(equippable.def.BuildOverride.GetData(), equippable.def.BuildOverridePriority); } Attributes attributes = targetGameObject.GetAttributes(); if (attributes != null) { foreach (AttributeModifier attributeModifier in equippable.def.AttributeModifiers) { attributes.Remove(attributeModifier); } } if (!equippable.def.IsBody) { SnapOn component2 = targetGameObject.GetComponent <SnapOn>(); component2.DetachSnapOnByName(equippable.def.SnapOn); if (equippable.def.SnapOn1 != null) { component2.DetachSnapOnByName(equippable.def.SnapOn1); } } if ((bool)equippable.transform.parent) { Storage component3 = equippable.transform.parent.GetComponent <Storage>(); if ((bool)component3) { component3.Drop(equippable.gameObject, true); } } SetEquippableStoredModifiers(equippable, false); equippable.transform.parent = null; equippable.transform.SetPosition(targetGameObject.transform.GetPosition() + Vector3.up / 2f); KBatchedAnimController component4 = equippable.GetComponent <KBatchedAnimController>(); if ((bool)component4) { component4.SetSceneLayer(Grid.SceneLayer.Ore); } if (!((Object)component == (Object)null)) { if (refreshHandle.TimeRemaining > 0f) { refreshHandle.ClearScheduler(); } refreshHandle = GameScheduler.Instance.Schedule("ChangeEquipment", 1f, delegate { GameObject gameObject = (!((Object)this != (Object)null)) ? null : GetTargetGameObject(); if ((bool)gameObject) { CreatureSimTemperatureTransfer component5 = gameObject.GetComponent <CreatureSimTemperatureTransfer>(); if ((Object)component5 != (Object)null) { component5.RefreshRegistration(); } } }, null, null); } } Game.Instance.Trigger(-2146166042, null); } }