public bool IsWithinReach(IApproachable approachable) { if ((bool)navigator) { if ((UnityEngine.Object) this == (UnityEngine.Object)null || (UnityEngine.Object)base.gameObject == (UnityEngine.Object)null) { return(false); } return(Grid.IsCellOffsetOf(Grid.PosToCell(this), approachable.GetCell(), approachable.GetOffsets())); } if (consumerState.hasSolidTransferArm) { return(consumerState.solidTransferArm.IsCellReachable(approachable.GetCell())); } return(false); }
public int GetNavigationCost(Navigator navigator) { int num = -1; int cell = Grid.PosToCell(this); IApproachable component = GetComponent <IApproachable>(); CellOffset[] array = (component != null) ? component.GetOffsets() : new CellOffset[1] { default(CellOffset) }; CellOffset[] array2 = array; foreach (CellOffset offset in array2) { int cell2 = Grid.OffsetCell(cell, offset); int navigationCost = navigator.GetNavigationCost(cell2); if (navigationCost != -1 && (num == -1 || navigationCost < num)) { num = navigationCost; } } return(num); }
public void OnTargetMoved(object data) { int num = Grid.PosToCell(base.smi.master.gameObject); if ((UnityEngine.Object)base.smi.sm.attackTarget.Get(base.smi) == (UnityEngine.Object)null) { CleanUpMultitool(); } else { if (base.smi.GetCurrentState() == base.smi.sm.attack) { int num2 = Grid.PosToCell(base.smi.sm.attackTarget.Get(base.smi).gameObject); CellOffset[] array = null; IApproachable component = base.smi.sm.attackTarget.Get(base.smi).gameObject.GetComponent <IApproachable>(); if (component != null) { array = component.GetOffsets(); if (num == num2 || !Grid.IsCellOffsetOf(num, num2, array)) { if (multiTool != null) { CleanUpMultitool(); } base.smi.GoTo(base.smi.sm.approachtarget); } } else { Debug.Log("has no approachable"); } } if (multiTool != null) { multiTool.UpdateHitEffectTarget(); } } }
public int GetNavigationCost(IApproachable approachable) { return(GetNavigationCost(approachable.GetCell(), approachable.GetOffsets())); }
public bool CanReach(IApproachable approachable) { return(CanReach(approachable.GetCell(), approachable.GetOffsets())); }