private string Proceed_DO_RESCAN(string[] terms) { string sReturn = string.Empty; if (terms.Length != 1) { sReturn = string.Format("-KO Wrong command format, {0} takes 0 argument(s)", terms[0]); } else { lock (Conf) { Conf.RescanPending = true; } Communicator.AddMessage(new ICCActionConfScanBus() { Address = 0x00, Conf = Conf }); sReturn = "+OK"; } return(sReturn); }
Node.NodeState GetNearestCheckPoint() { List <Communicator.Message> checkpointMassage = m_communicator.Find(Communicator.Message.CommunicationType.GOTO_CHECKPOINT); GameObject nearestCheckpoint = null; float nearestDistance = 0; foreach (GameObject ch in manager.CheckPoints) { CheckPointEngine check = ch.GetComponent <CheckPointEngine>(); if (check != null && check.TeamOwner != Team) { Communicator.Message ch_obj = checkpointMassage.Find(x => x.target == ch); if (checkpointMassage.IndexOf(ch_obj) < 0) { float distance = Vector3.Distance(transform.position, ch.transform.position); if (nearestDistance == 0 || nearestDistance > distance) { nearestDistance = distance; nearestCheckpoint = ch; } } } } if (nearestCheckpoint != null) { m_destinationCheckpoint = nearestCheckpoint; m_communicator.AddMessage(gameObject, nearestCheckpoint, Communicator.Message.CommunicationType.GOTO_CHECKPOINT); return(Node.NodeState.SUCCESS); } else { return(Node.NodeState.FAILED); } }