public bool MoveToTargetObject(TargetableObject targetObject) { if (destinationObject && targetObject) { if (destinationObject.GetInstanceID() == targetObject.GetInstanceID() && IsDocked()) { if (dockedIn.GetInstanceID() == targetObject.GetInstanceID()) { return(true); } } } Debug.Log("Moving to target obj"); if (targetObject == null) { destinationObject = null; MoveToPosition(transform.position); Debug.LogError("TargetObject == null! Was that intended?"); return(false); } MoveToPosition(targetObject.GetEntrancePos()); destinationObject = targetObject; if (destinationObject) { if (IsOnDestinationPosition()) { return(true); } } return(false); }
public static bool WasThisBattleAlreadyStarted(TargetableObject attacker, TargetableObject defender) { foreach (BattleInfo item in thisFrameBattles) { if (item != null) { if (item.GetAttacker().GetInstanceID() == attacker.GetInstanceID() && item.GetDefender().GetInstanceID() == defender.GetInstanceID() || item.GetAttacker().GetInstanceID() == defender.GetInstanceID() && item.GetDefender().GetInstanceID() == attacker.GetInstanceID()) { return(true); } } } return(false); }