public async Task ListWaifus(int page = 0) { if (page != 0) { page -= 1; } List <Waifus> Ws; using (var uow = DBHandler.UnitOfWork()) { Ws = uow.Waifus.GetWaifus(page); } if (!Ws.Any()) { await Context.Channel.SendErrorAsync($"No Waifus found for page {page + 1}"); return; } EmbedBuilder embed = new EmbedBuilder().WithOkColour().WithTitle($"Waifus").WithFooter(efb => efb.WithText($"Page: {page + 1}")); string desc = ""; foreach (Waifus w in Ws) { desc += $"{w.ID}. {w.Waifu}\n"; } embed.WithDescription(desc); await Context.Channel.BlankEmbedAsync(embed); }
/// <summary> /// Helper method used to build a Dpws compliant soap response message. /// </summary> /// <param name="header">A valid response header object.</param> /// <param name="Dcs">A data contract serializer used to serialize the response body.</param> /// <param name="bodyContent">A object containing the data to serialize.</param> /// <returns>A byte array containing the soap reponse message.</returns> public static byte[] BuildSoapMessage(WsWsaHeader header, Ws.Services.Serialization.DataContractSerializer Dcs, object bodyContent) { lock (m_ThreadLock) { // Build response message MemoryStream soapStream; soapStream = new MemoryStream(); XmlWriter xmlWriter; xmlWriter = XmlWriter.Create(soapStream); // Write start message up to body element content WsSoapMessageWriter.WriteSoapMessageStart(xmlWriter, WsSoapMessageWriter.Prefixes.Wsdp, null, header, null); // Serialize the body element if (bodyContent != null) { Dcs.WriteObject(xmlWriter, bodyContent); } WsSoapMessageWriter.WriteSoapMessageEnd(xmlWriter); // Flush writer and build return array xmlWriter.Flush(); byte[] soapBuffer = soapStream.ToArray(); xmlWriter.Close(); // Return soap message return soapBuffer; } }
protected override void OnMessage() { _incomingBuffer = new ArraySegment <byte>(new byte[1024]); Ws.ReceiveAsync(_incomingBuffer, CancellationToken.None).GetAwaiter().OnCompleted(() => { try { if (Ws.State == WebSocketState.Closed) { return; } string response = Encoding.UTF8.GetString(_incomingBuffer); Console.WriteLine("res---->" + response); _update = JsonConvert.DeserializeObject <ExpandoObject>(response); if (_update == null) { return; } if (_update is ExpandoObject) { IDictionary <string, object> updateDictionary = (IDictionary <string, object>)_update; if (updateDictionary.ContainsKey("messageState")) { switch (updateDictionary["messageState"]) { case "saved": if (updateDictionary.ContainsKey("id")) { _messages.Last().id = (string)_update.id; } break; case "seen": _messages.Where(x => x.id == (string)_update.id).First().Seen = (bool)_update.seen; break; case "incoming": _messages.Add(new Message { Body = _update.body, From = _update.from, id = _update.id, MessageType = "text", Seen = false, To = _update.to, Token = _update.token }); break; } } } OnMessage(); } catch (Exception ex) { Console.WriteLine("Server Bad Response :" + ex.Message); } }); }
override public void initialize() { setProblemClass(); int total_nodes = this.Ranks.Length; maxcells = Convert.ToInt32(Math.Sqrt(total_nodes)); ncells = Convert.ToInt32(Math.Sqrt(total_nodes)); MAX_CELL_DIM = (problem_size / maxcells) + 1; IMAX = JMAX = KMAX = MAX_CELL_DIM; _grid_points_[0] = _grid_points_[1] = _grid_points_[2] = problem_size; IMAXP = IMAX / 2 * 2 + 1; JMAXP = JMAX / 2 * 2 + 1; set_constants(0, dt_default); U.initialize_field("u", maxcells, KMAX + 4, JMAXP + 4, IMAXP + 4, 5); Rhs.initialize_field("rhs", maxcells, KMAX + 2, JMAXP + 2, IMAXP + 2, 5); Lhs.initialize_field("lhs", maxcells, KMAX + 2, JMAXP + 2, IMAXP + 2, 15); Forcing.initialize_field("forcing", maxcells, KMAX + 2, JMAXP + 2, IMAXP + 2, 5); Us.initialize_field("us", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Vs.initialize_field("vs", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Ws.initialize_field("ws", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Qs.initialize_field("qs", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Ainv.initialize_field("ainv", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Rho.initialize_field("rho", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Speed.initialize_field("speed", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); Square.initialize_field("square", maxcells, KMAX + 3, JMAX + 3, IMAX + 3); //Lhsa.initialize_field("lhsa", maxcells, KMAX+2, JMAXP+2, IMAXP+2, 15); //Lhsb.initialize_field("lhsb", maxcells, KMAX+2, JMAXP+2, IMAXP+2, 15); //Lhsc.initialize_field("lhsc", maxcells, KMAX+2, JMAXP+2, IMAXP+2, 15); }
public async Task Send(byte[] data) { var array = new ArraySegment <byte>(data); await Ws.SendAsync(array, WebSocketMessageType.Binary, false, cancel.Token); Logger?.Invoke("Sended [" + data.Length + "] Byte Data."); }
private IEnumerator SendHearthbeats() { while ((!IsGameRunning) && IsInLobby) { Ws.SendHearthbeat(); yield return(new WaitForSeconds(45)); } }
private void SendSeen(string id) { if (Ws.State == WebSocketState.Open) { Ws.SendAsync(new ArraySegment <byte>(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(new { seen = id, id = FileManager.CreateInstance().Fetch("token") }))) , WebSocketMessageType.Text, true, CancellationToken.None); } }
private async Task <string> Receive() { var array = new ArraySegment <byte>(new byte[256]); var result = await Ws.ReceiveAsync(array, cancel.Token); var res = Encoding.UTF8.GetString(array.Take(result.Count).ToArray()); return(res); }
public void Connect() { Ws.OnMessage += OnMessageThread; Ws.OnClose += OnCloseThread; Ws.Connect(); MyWnd.Reset2New(); }
protected override void Action() { base.Action(); Wb.Activate(); Ws.Select(); if (Range != null && (!Range.Equals(""))) { App.Range[Range].Select(); } }
public void SendMessage(int opAction, byte[] toBytes) { var gmsg = new GameMessage { Ops = (int)opAction, Data = toBytes }; var msgBytes = gmsg.ToBytes(); Ws?.Send(msgBytes); }
private void ReadShapefileWorksapceFactory(string path) { Wsf = new ShapefileWorkspaceFactoryClass(); Directory = System.IO.Path.GetDirectoryName(path); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path); Extension = System.IO.Path.GetExtension(path); Ws = Wsf.OpenFromFile(Directory, 0); FeatWs = Ws as IFeatureWorkspace; FeatCls = FeatWs.OpenFeatureClass(NameWithoutExtension); EnumDs = Ws.get_Datasets(esriDatasetType.esriDTFeatureClass); }
private IEnumerator SendPlayerLocation() { while (IsGameRunning) { if (LocalPlayer != null && LocalPlayer.location != null) { Ws.SendLocation(LocalPlayer.location); } yield return(new WaitForSeconds(1)); //todo tweak } }
public void Clear() { ClientToken = null; GameId = null; PasswordUsed = null; IsTaggingPermitted = false; TagablePlayers = new List <string>(); HalfwayPassed = false; TenMinuteMark = false; LastMinuteMark = false; Ws.Clear(); }
protected override void SendAuthenticationToken() { string id = FileManager.CreateInstance().Fetch("token"); OutgoingBuffer = new ArraySegment <byte>(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { id, username }))); Ws.SendAsync(OutgoingBuffer, WebSocketMessageType.Text, true, default).GetAwaiter().OnCompleted(() => { Console.WriteLine("Connected.."); Console.WriteLine("token has been Send.."); Thread.Sleep(500); OnMessage(); }); }
public Task Send(byte [] bytes, CancellationToken token) { pending.Add(bytes); if (pending.Count == 1) { if (current_send != null) { throw new Exception("WTF, current_send MUST BE NULL IF THERE'S no pending send"); } //Console.WriteLine ("sending {0} bytes", bytes.Length); current_send = Ws.SendAsync(new ArraySegment <byte> (bytes), WebSocketMessageType.Text, true, token); return(current_send); } return(null); }
public void Init() { _restProtocol.Init(); Ws.On(PUBLISH_EVENT, data => { var msg = data.ToObject <HubEventMessage>(); if (EventReceive != null) { EventReceive(this, new EventArgs <HubEventMessage>(msg)); } }); Ws.EventReconnected += (s, e) => { Api.Auth.EventAuthenticateChange += Auth_EventAuthenticateChange; }; }
private void ReadFileGDBWorkspaceFactory(string path) { Wsf = new FileGDBWorkspaceFactoryClass(); Directory = path.Substring(0, path.IndexOf(".gdb") + 4); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Extension = System.IO.Path.GetExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Ws = Wsf.OpenFromFile(Directory, 0); RstWsEx = Ws as IRasterWorkspaceEx; RstDs = RstWsEx.OpenRasterDataset(NameWithoutExtension) as IRasterDataset2; Rst = RstDs.CreateDefaultRaster(); RstProps = Rst as IRasterProps; RawBlocks = (IRawBlocks)RstDs; RstInfo = RawBlocks.RasterInfo; EnumDs = Ws.get_Datasets(esriDatasetType.esriDTRasterDataset); }
private void ReadRasterWorkspaceFactory(string path) { Wsf = new RasterWorkspaceFactoryClass(); Directory = System.IO.Path.GetDirectoryName(path); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path); Extension = System.IO.Path.GetExtension(path); Ws = Wsf.OpenFromFile(Directory, 0); RstWs = Ws as IRasterWorkspace; RstDs = RstWs.OpenRasterDataset(NameWithoutExtension + Extension) as IRasterDataset2; Rst = RstDs.CreateDefaultRaster(); RstProps = Rst as IRasterProps; RawBlocks = (IRawBlocks)RstDs; RstInfo = RawBlocks.RasterInfo; EnumDs = Ws.get_Datasets(esriDatasetType.esriDTRasterDataset); }
public Task Pump(CancellationToken token) { current_send = null; pending.RemoveAt(0); if (pending.Count > 0) { if (current_send != null) { throw new Exception("current_send MUST BE NULL IF THERE'S no pending send"); } current_send = Ws.SendAsync(new ArraySegment <byte>(pending[0]), WebSocketMessageType.Text, true, token); return(current_send); } return(null); }
public Task Pump(CancellationToken token) { current_send = null; pending.RemoveAt(0); if (pending.Count > 0) { if (current_send != null) { throw new Exception("WTF, current_send MUST BE NULL IF THERE'S no pending send"); } //Console.WriteLine ("sending more {0} bytes", pending[0].Length); current_send = Ws.SendAsync(new ArraySegment <byte> (pending [0]), WebSocketMessageType.Text, true, token); return(current_send); } return(null); }
public bool TryPumpIfCurrentCompleted(CancellationToken token, [NotNullWhen(true)] out Task?sendTask) { sendTask = null; if (current_send?.IsCompleted == false) { return(false); } current_send = null; if (pending.TryDequeue(out byte[]? bytes)) { current_send = Ws.SendAsync(new ArraySegment <byte>(bytes), WebSocketMessageType.Text, true, token); sendTask = current_send; } return(sendTask != null); }
/// <summary> /// Helper method used by a hosted service to generate an event messages body elements. /// </summary> /// <param name="header">A valid response header object.</param> /// <param name="Dcs">A data contract serializer used to serialize the response body.</param> /// <param name="bodyContent">A object containing the data to serialize.</param> /// <returns>A byte array containg the serialized body elements of event message.</returns> public static byte[] BuildEventBody(WsWsaHeader header, Ws.Services.Serialization.DataContractSerializer Dcs, object bodyContent) { // Create an XmlWriter MemoryStream soapStream; soapStream = new MemoryStream(); XmlWriter xmlWriter = XmlWriter.Create(soapStream); // Create Xml body element Dcs.WriteObject(xmlWriter, bodyContent); // Flush writer and build message buffer xmlWriter.Flush(); byte[] soapBuffer = soapStream.ToArray(); xmlWriter.Close(); // return xml message buffer return soapBuffer; }
private void button1_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application XcelApp = new Microsoft.Office.Interop.Excel.Application(); Excel.Workbook WB; Excel.Worksheet Ws; Excel.Range Rang; WB = XcelApp.Workbooks.Add(Type.Missing); WB.Worksheets.Add(Type.Missing, Type.Missing, 1, Excel.XlSheetType.xlWorksheet); // I am opening Excel Ws = (Excel.Worksheet)WB.Worksheets.get_Item(1); XcelApp.Visible = true; XcelApp.StandardFont = "Tahoma"; //I am filling Data XcelApp.Cells[1, 1] = "Student Result"; Rang = Ws.get_Range("A1", "G2"); Rang.Font.Name = "MV Boli"; Rang.Font.Size = 22F; Rang.Font.Bold = true; Rang.MergeCells = true; Rang.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; Rang.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; XcelApp.Cells[3, 1] = "Sno"; XcelApp.Cells[3, 2] = "surname"; XcelApp.Cells[3, 3] = "other names"; XcelApp.Cells[3, 4] = "gender"; XcelApp.Cells[3, 5] = "Class"; XcelApp.Cells[3, 6] = "Mathematics"; //Rang = Ws.get_Range("C3", "E3"); Rang.MergeCells = true; Rang = Ws.get_Range("A3", "G3"); Rang.Font.Bold = true; DataSet ds = new DataSet(); ds = c1.FillDs("Select * from Result2"); int cnt = ds.Tables[0].Rows.Count; for (int i = 0; i <= cnt - 1; i++) { XcelApp.Cells[4 + i, 1] = ds.Tables[0].Rows[i]["S_ID"].ToString(); XcelApp.Cells[4 + i, 2] = ds.Tables[0].Rows[i]["Surname"].ToString(); XcelApp.Cells[4 + i, 3] = ds.Tables[0].Rows[i]["OtherNames"].ToString(); XcelApp.Cells[4 + i, 4] = ds.Tables[0].Rows[i]["Gender"].ToString(); XcelApp.Cells[4 + i, 5] = ds.Tables[0].Rows[i]["Class"].ToString(); XcelApp.Cells[4 + i, 6] = ds.Tables[0].Rows[i]["Mathematics"].ToString(); } XcelApp.Columns.AutoFit(); }
public async Task <bool> Connect() { try { await Ws.ConnectAsync(new System.Uri(Uri), cancel.Token); if (Ws.State == WebSocketState.Open) { Logger?.Invoke("Connected"); return(true); } else { Logger?.Invoke("Aborted : " + Ws.CloseStatusDescription); return(false); } } catch { return(false); } }
private void ComputeStationaryPTC() { for (int i = 0; i < NodesCount; i++) { double sum = 0.0; for (int stream = 0; stream < StreamsCount; stream++) { sum += RoBar[stream][i] / Mu[stream][i]; } Ws.AddElement(sum / (1 - RoTotal[i])); } for (int stream = 0; stream < StreamsCount; stream++) { Us.Add(Ws.AddElementWise(Mu[stream].Pow(-1))); Ls.Add(LambdaBar[stream].MultiplyElementWise(Ws)); Ns.Add(LambdaBar[stream].MultiplyElementWise(Us[stream])); } }
private void ReadFileGDBWorkspaceFactory(string path) { Wsf = new FileGDBWorkspaceFactoryClass(); Directory = path.Substring(0, path.IndexOf(".gdb") + 4); FeatDsName = System.IO.Path.GetDirectoryName(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); NameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Extension = System.IO.Path.GetExtension(path.Substring(path.IndexOf(".gdb") + 5, path.Length - path.IndexOf(".gdb") - 5)); Ws = Wsf.OpenFromFile(Directory, 0); FeatWs = Ws as IFeatureWorkspace; if (FeatDsName.Equals(string.Empty)) { IFeatureClassContainer featClsCtn = FeatWs.OpenFeatureDataset(FeatDsName) as IFeatureClassContainer; FeatCls = featClsCtn.get_ClassByName(NameWithoutExtension); EnumDs = Ws.get_Datasets(esriDatasetType.esriDTFeatureClass); } else { FeatCls = FeatWs.OpenFeatureClass(NameWithoutExtension); IFeatureDataset FeatDs = FeatWs.OpenFeatureDataset(FeatDsName); EnumDs = FeatDs.Subsets; } }
public void Init() { _restProtocol.Init(); Ws.On(PUBLISH_EVENT, data => { var msg = data.ToObject <HubEventMessage>(); if (EventReceive != null) { EventReceive(this, new EventArgs <HubEventMessage>(msg)); } }); Ws.EventConnectionChange += (s, e) => { if (_firstTimeConnection) { _firstTimeConnection = false; } if (e.Value && !_firstTimeConnection) { Api.Auth.EventAuthenticateChange += Auth_EventAuthenticateChange; } }; }
private void SendMessage() { Console.Write(":"); Message outgoing = new Message { From = Me.Username, MessageType = "text", To = username, Token = new Random(DateTime.Now.Second).Next(999, 10000) + "", Body = Console.ReadLine() }; _messages.Add(outgoing); string id = FileManager.CreateInstance().Fetch("token"); OutgoingBuffer = new ArraySegment <byte>(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { id, message = outgoing.Body, username = outgoing.To, token = outgoing.Token }))); Ws.SendAsync(OutgoingBuffer, WebSocketMessageType.Text, true, default).GetAwaiter().OnCompleted(() => { Scene(); }); Thread.Sleep(3000); }
public void SendMessage(int opAction, byte[] toBytes) { ByteString data = null; if (toBytes != null) { data = ByteString.CopyFrom(toBytes); } else { data = ByteString.Empty; } var gmsg = new GameMessage { Code = opAction, Data = data }; var msgBytes = gmsg.ToBytes(); Ws?.Send(msgBytes); }
protected void Awake() { ttm = GetComponent <TargetTrackingManager>(); base.Awake(); actions = new List <Action>(); startWS = new Ws(); //set the worlds states for the start of the game startWS.SetVal(Wstates.KnowledgeOfTree, true); startWS.SetVal(Wstates.KnowledgeOfNails, true); startWS.SetVal(Wstates.KnowledgeOfHouse, true); startWS.SetVal(Wstates.KnowledgeOfTent, true); startWS.SetVal(Wstates.KnowledgeOfWeapon, true); // creating all of the actions that the AI will need to complete its neccassary goal. each action will be initilised with the name, cost, object and type of action. //Along with its preconditions and effects to the world state. //Action being created Action GetWood = new GetWood("GetWood", 1, this, TacticalStates.Goto); GetWood.SetPreCondition(Wstates.KnowledgeOfTree, true); GetWood.SetEffect(Wstates.LocatedAtTree, true); GetWood.destination = GameObject.FindGameObjectWithTag("Tree").transform; actions.Add(GetWood); //Action being created Action CutTree = new CutTree("CutTree", 1, this, TacticalStates.Goto); CutTree.SetPreCondition(Wstates.KnowledgeOfTree, true); CutTree.SetPreCondition(Wstates.LocatedAtTree, true); CutTree.SetEffect(Wstates.HasWood, true); CutTree.destination = GameObject.FindGameObjectWithTag("Tree").transform; actions.Add(CutTree); //Action being created Action getNails = new GetNails("GoToNails", 1, this, TacticalStates.Goto); getNails.SetPreCondition(Wstates.HasWood, true); getNails.SetPreCondition(Wstates.KnowledgeOfNails, true); getNails.SetEffect(Wstates.LocatedAtNails, true); getNails.destination = GameObject.FindGameObjectWithTag("Nails").transform; actions.Add(getNails); //Action being created Action pickUpNails = new PickupNails("Getting nails", 1, this, TacticalStates.Goto); pickUpNails.SetPreCondition(Wstates.KnowledgeOfNails, true); pickUpNails.SetPreCondition(Wstates.LocatedAtNails, true); pickUpNails.SetEffect(Wstates.HasNails, true); pickUpNails.destination = GameObject.FindGameObjectWithTag("Nails").transform; actions.Add(pickUpNails); //Action being created Action goHouse = new GoHouse("GoTo House", 1, this, TacticalStates.Goto); goHouse.SetPreCondition(Wstates.KnowledgeOfHouse, true); goHouse.SetPreCondition(Wstates.HasNails, true); goHouse.SetPreCondition(Wstates.HasWood, true); goHouse.SetEffect(Wstates.LocatedAtHouse, true); goHouse.destination = GameObject.FindGameObjectWithTag("house").transform; actions.Add(goHouse); //Action being created Action BuildHouse = new buildHouse("Build house", 1, this, TacticalStates.Goto); goHouse.SetPreCondition(Wstates.KnowledgeOfHouse, true); BuildHouse.SetPreCondition(Wstates.HasNails, true); BuildHouse.SetPreCondition(Wstates.HasWood, true); BuildHouse.SetPreCondition(Wstates.LocatedAtHouse, true); BuildHouse.SetEffect(Wstates.HouseIsBuilt, true); BuildHouse.destination = GameObject.FindGameObjectWithTag("house").transform; actions.Add(BuildHouse); //Action being created Action GoToTent = new GoToTent("Tent", 1, this, TacticalStates.Goto); GoToTent.SetPreCondition(Wstates.KnowledgeOfTent, true); GoToTent.SetPreCondition(Wstates.HouseIsBuilt, true); GoToTent.SetEffect(Wstates.LocatedAtTent, true); GoToTent.destination = GameObject.FindGameObjectWithTag("Tent").transform; actions.Add(GoToTent); //Action being created Action GoToWeapon = new GetWeapon("Weapon", 1, this, TacticalStates.Goto); GoToWeapon.SetPreCondition(Wstates.KnowledgeOfWeapon, true); GoToWeapon.SetPreCondition(Wstates.CanSeeBear, true); GoToWeapon.SetEffect(Wstates.HasWeapon, true); GoToWeapon.destination = GameObject.FindGameObjectWithTag("Weapon").transform; actions.Add(GoToWeapon); //Action being created Action GoBear = new GoToBear("GoBear", 1, this, TacticalStates.Goto); GoBear.SetPreCondition(Wstates.HasWeapon, true); GoBear.SetPreCondition(Wstates.CanSeeBear, true); GoBear.SetEffect(Wstates.LocatedAtBear, true); GoBear.destination = GameObject.FindGameObjectWithTag("Bear").transform; actions.Add(GoBear); //Action being created Action killBear = new KillBear("killing", 1, this, TacticalStates.Goto); killBear.SetPreCondition(Wstates.CanSeeBear, true); killBear.SetPreCondition(Wstates.LocatedAtBear, true); killBear.SetEffect(Wstates.BearDead, true); actions.Add(killBear); goals = new List <Goal>(); //creating the goals for the AI, each goal will be initilised with a priotity and the world state conditions that will need to be met, for the AI to complete the goal //Goal being created Goal BuildGoal = new Goal(10); BuildGoal.condition.SetVal(Wstates.LocatedAtTree, true); BuildGoal.condition.SetVal(Wstates.HasWood, true); BuildGoal.condition.SetVal(Wstates.LocatedAtNails, true); BuildGoal.condition.SetVal(Wstates.HasNails, true); BuildGoal.condition.SetVal(Wstates.LocatedAtHouse, true); BuildGoal.condition.SetVal(Wstates.HouseIsBuilt, true); BuildGoal.condition.SetVal(Wstates.LocatedAtTent, true); goals.Add(BuildGoal); //Goal being created Goal KillBear = new Goal(9); KillBear.condition.SetVal(Wstates.CanSeeBear, true); KillBear.condition.SetVal(Wstates.HasWeapon, true); KillBear.condition.SetVal(Wstates.BearDead, true); goals.Add(KillBear); // Build the Finite State Machine tacticalStateMachine = new FSM <TacticalStates>(displayFSMTransitions); tacticalStateMachine.AddState(new Goto <TacticalStates>(TacticalStates.Goto, this, 0f)); tacticalStateMachine.AddState(new Animate <TacticalStates>(TacticalStates.Animate, this, 0f)); tacticalStateMachine.AddState(new UseSmartObject <TacticalStates>(TacticalStates.UseSmartObject, this, 0f)); tacticalStateMachine.AddTransition(TacticalStates.Goto, TacticalStates.Animate); tacticalStateMachine.AddTransition(TacticalStates.Goto, TacticalStates.UseSmartObject); tacticalStateMachine.AddTransition(TacticalStates.Goto, TacticalStates.Goto); tacticalStateMachine.AddTransition(TacticalStates.Animate, TacticalStates.Goto); tacticalStateMachine.AddTransition(TacticalStates.Animate, TacticalStates.UseSmartObject); tacticalStateMachine.AddTransition(TacticalStates.Animate, TacticalStates.Animate); tacticalStateMachine.AddTransition(TacticalStates.UseSmartObject, TacticalStates.Goto); tacticalStateMachine.AddTransition(TacticalStates.UseSmartObject, TacticalStates.Animate); tacticalStateMachine.AddTransition(TacticalStates.UseSmartObject, TacticalStates.UseSmartObject); }
public void Connect() { StartCoroutine(Ws.Connect(URL, GameId, LocalPlayer.clientID)); }