public void Move(Character character, Vector3 destination) { var destinationTile = engine.MovementGrid.GetTileAt(destination); var characterTile = engine.MovementGrid.GetTileAt(character.transform.position); LiftAction <MovementTile, MovementTile>((src, dest) => character.Move(src, dest))(characterTile, destinationTile); }
public async Task <actionStatus> doLiftAction(LiftAction p_objLiftAction) { var l_objStatus = actionStatus.None; var l_strFunctionName = "doLiftAction()"; var l_blnPerformAwait = false; try { m_objLogger.logToMemory(string.Format("{0}: {1}: Attempting to performs action: {2}", l_strFunctionName, LiftName, p_objLiftAction.ToString()), l_objStatus); var l_strCurrentAction = ""; switch (p_objLiftAction) { case LiftAction.Cancel: l_strCurrentAction = m_cstrCancel; break; case LiftAction.Extend: l_strCurrentAction = m_cstrExtend; l_blnPerformAwait = true; break; case LiftAction.Retract: l_strCurrentAction = m_cstrRetract; l_blnPerformAwait = true; break; default: throw new Exception(string.Format("Lift Action: {0} Not Found!", p_objLiftAction.ToString())); } m_objLogger.logToMemory(string.Format("{0}: {1}: Lift Action Found. Attempting to Send Message through Serial Port: {2})", l_strFunctionName, LiftName, LiftCOMPort), l_objStatus); sendSerialData(LiftCOMPort, 9600, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One, l_strCurrentAction); if (l_blnPerformAwait) { await Task.Delay(LiftMoveTime); } l_objStatus = actionStatus.Success; m_objLogger.logToMemory(string.Format("{0}: {1}: Lift Action Message Sent: {2}", l_strFunctionName, LiftName, l_strCurrentAction), l_objStatus); } catch (Exception e) { l_objStatus = actionStatus.Error; m_objLogger.logToMemory(string.Format("{0}: {1}: Error Performing Lift Action: {2}", l_strFunctionName, LiftName, e.ToString()), l_objStatus); } finally { m_objLogger.writePendingToDB(l_objStatus, p_strFunctionName: l_strFunctionName); } return(l_objStatus); }