public static Component GetPlateLocationComponent(ClientPlate plate) { Component locationComponent = GetObjectLocationComponent(plate); if (locationComponent != null) { return(locationComponent); } ClientPlateReturnStation[] plateReturnStations = Object.FindObjectsOfType <ClientPlateReturnStation>(); foreach (ClientPlateReturnStation plateReturnStation in plateReturnStations) { ClientPlateStackBase plateStackBase = (ClientPlateStackBase)ReflectionUtil.GetValue(plateReturnStation, "m_stack"); ClientStack clientStack = (ClientStack)ReflectionUtil.GetValue(plateStackBase, "m_stack"); List <GameObject> stackItems = (List <GameObject>)ReflectionUtil.GetValue(clientStack, "m_stackItems"); if (stackItems.Contains(plate.gameObject)) { return(plateReturnStation); } } return(null); }
public static void LogPlate() { ClientPlate plate = Object.FindObjectOfType <ClientPlate>(); Logger.Log($"Plate location: {Logger.FormatPosition(plate.transform.position)}"); Logger.Log("Before method call"); Component component = ComponentUtil.GetPlateLocationComponent(plate); Logger.Log("After method call"); Logger.Log($"Component name: {component.name}"); }
public DeliverPlateAction(PlayerControls player, ClientPlate plate) { this.player = player; state = 0; Logger.Log("DeliverPlateAction instantiated"); if (ComponentUtil.IsPlateOnComponent(plate)) { currentAction = new PathFindAction(player, ComponentUtil.GetPlateLocationComponent(plate)); } else { currentAction = new PathFindAction(player, plate); } }
public PlateHoldingAction(PlayerControls player) { this.player = player; plate = ComponentUtil.GetClosestComponent <ClientPlate>(PlayerUtil.GetChefPosition(player)); state = 0; if (ComponentUtil.IsPlateOnComponent(plate)) { currentAction = new PathFindAction(player, ComponentUtil.GetPlateLocationComponent(plate)); } else { currentAction = new PathFindAction(player, plate); } }
public PlateHoldingAction(PlayerControls player, ClientPlate plate) { this.player = player; this.plate = plate; state = 0; Logger.Log("PlateHoldingAction instantiated"); if (ComponentUtil.IsPlateOnComponent(plate)) { currentAction = new PathFindAction(player, ComponentUtil.GetPlateLocationComponent(plate)); Logger.Log("Pathfinding component?"); } else { currentAction = new PathFindAction(player, plate); Logger.Log("Pathfinding plate?"); } }
public static bool IsPlateOnComponent(ClientPlate plate) { return(GetPlateLocationComponent(plate) != null); }