private static void ClearBait(Instance smi) { Lure.Instance sMI = smi.GetSMI <Lure.Instance>(); if (sMI != null) { smi.GetSMI <Lure.Instance>().SetActiveLures(null); } }
private static CellOffset[] GetLureOffsets(Instance smi) { Lure.Instance targetLure = GetTargetLure(smi); if (targetLure == null) { return(null); } return(targetLure.def.lurePoints); }
private static int GetLureCell(Instance smi) { Lure.Instance targetLure = GetTargetLure(smi); if (targetLure == null) { return(Grid.InvalidCell); } return(Grid.PosToCell(targetLure)); }
protected override void OnSpawn() { base.OnSpawn(); Tag[] constructionElements = GetComponent <Deconstructable>().constructionElements; baitElement = constructionElements[1]; Lure.Instance sMI = base.gameObject.GetSMI <Lure.Instance>(); sMI.SetActiveLures(new Tag[1] { baitElement }); base.smi.StartSM(); }
public void Iterate(object target_obj) { Lure.Instance instance = target_obj as Lure.Instance; if (instance != null && instance.IsActive() && instance.HasAnyLure(lures)) { int navigationCost = navigator.GetNavigationCost(Grid.PosToCell(instance.transform.GetPosition()), instance.def.lurePoints); if (navigationCost != -1 && (cost == -1 || navigationCost < cost)) { cost = navigationCost; result = instance.gameObject; } } }
public override void InitializeStates(out BaseState default_state) { default_state = move; root.ToggleStatusItem(CREATURES.STATUSITEMS.CONSIDERINGLURE.NAME, CREATURES.STATUSITEMS.CONSIDERINGLURE.TOOLTIP, category: Db.Get().StatusItemCategories.Main, icon: string.Empty, icon_type: StatusItem.IconType.Info, notification_type: NotificationType.Neutral, allow_multiples: false, render_overlay: default(HashedString), status_overlays: 129022, resolve_string_callback: null, resolve_tooltip_callback: null); move.MoveTo(GetLureCell, GetLureOffsets, arrive_at_lure, behaviourcomplete, false); arrive_at_lure.Enter(delegate(Instance smi) { Lure.Instance targetLure = GetTargetLure(smi); if (targetLure != null && targetLure.HasTag(GameTags.OneTimeUseLure)) { targetLure.GetComponent <KPrefabID>().AddTag(GameTags.LureUsed, false); } }).GoTo(behaviourcomplete); behaviourcomplete.BehaviourComplete(GameTags.Creatures.MoveToLure, false); }