private void InitContents( BarrelType type ) { Item item = null; byte count = (byte)Utility.RandomMinMax( 10, 30 ); for( byte i = 0; i < count; i++ ) { switch( type ) { default: case BarrelType.Arrows: item = new Arrow( Utility.RandomMinMax( 2, 6 ) ); break; case BarrelType.Bolts: item = new Bolt( Utility.RandomMinMax( 2, 6 ) ); break; case BarrelType.Farming: { if( i > 3 ) return; switch( Utility.Random( 3 ) ) { case 0: item = new Shovel(); break; case 1: item = new Scythe(); break; case 2: item = new Pitchfork(); break; } break; } case BarrelType.LargeMining: { if( i > 5 ) return; switch( Utility.Random( 5 ) ) { case 0: item = new Pitchfork(); break; case 1: case 2: item = new Shovel(); break; case 3: case 4: item = new Pickaxe(); break; } break; } case BarrelType.LargeWeapon1: case BarrelType.LargeWeapon2: case BarrelType.LargeWeapon3: { if( i > 6 ) return; switch( Utility.Random( 6 ) ) { case 0: item = new Spear(); break; case 1: item = new Halberd(); break; case 2: item = new Axe(); break; case 3: item = new ThinLongsword(); break; case 4: item = new WarAxe(); break; case 5: item = new VikingSword(); break; } break; } case BarrelType.Mining: { if( i > 3 ) return; item = new Pickaxe(); break; } case BarrelType.Spears: { if( i > 4 ) return; item = new Spear(); break; } case BarrelType.Weapons: { if( i > 3 ) return; switch( Utility.Random( 3 ) ) { case 0: item = new WarAxe(); break; case 1: item = new WarMace(); break; case 2: item = new Maul(); break; } break; } } if( item != null ) DropItem( item ); } }
public void Post([FromBody] Bolt ujelem) { webshopContext context = new webshopContext(); context.Bolts.Add(ujelem); context.SaveChanges(); }
private void Start() { timer = 0f; nextSpawnDelay = GetRandomTime(delay, delayRandomize); LineRenderer boltTemplate = this.GetComponent <LineRenderer>(); //initialize bolts for (int i = 0; i < bolts.Length; i++) { GameObject g = new GameObject("Bolt_" + i.ToString().PadLeft(2, '0')); g.transform.SetParent(transform); g.transform.localPosition = Vector3.zero; g.transform.localRotation = Quaternion.identity; bolts[i] = new Bolt(g, boltTemplate); } Destroy(boltTemplate); this.emitting = this.initOn; if (UFLevel.GetByID(targetID) == null || UFLevel.GetByID(targetID).objectRef == null) { Debug.LogWarning("Bolt emitter " + name + " has no valid target and will be deactivated"); this.gameObject.SetActive(false); } }
// Update is called once per frame void Update() { float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical"); Vector3 direction = new Vector3(horizontal, 0, vertical); direction = direction.normalized; mRB.velocity = direction * mSpeed; //transform.Translate(direction * Time.deltaTime); //잘사용안함 리짓바디안쓸때사용 mRB.rotation = Quaternion.Euler(0, 0, horizontal * -mTilted); mRB.position = new Vector3(Mathf.Clamp(mRB.position.x, mXMin, mXMax), 0, Mathf.Clamp(mRB.position.z, mZMin, mZMax)); if (Input.GetButton("Fire1") && mCurrnetFireLate >= mFireLate) //if (Input.GetKeyDown(KeyCode.Space)) { //GameObject obj = Instantiate(Bolt); Bolt blot = mBoltPool.GetFromPool(); blot.gameObject.transform.position = mBoltPos.position; //월드 좌표 //mBoltPos.localPosition // 오브젝트의 하위 mCurrnetFireLate = 0; } else { mCurrnetFireLate += Time.deltaTime; //deltatime = 프레임간 시간간격 } }
// Update is called once per frame void Update() { float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical"); rb.velocity = new Vector3(horizontal, 0, vertical) * Speed; rb.rotation = Quaternion.Euler(new Vector3(0, 0, -horizontal * RotateAngle)); rb.position = new Vector3(Mathf.Clamp(rb.position.x, -5, 5), 0, Mathf.Clamp(rb.position.z, -4, 9)); if (boltSizeTimer > 0) { boltSize = Vector3.one * 5; boltSizeTimer -= Time.deltaTime; } else { boltSize = Vector3.one; } if (Input.GetButton("Fire1") && currentRate <= 0) { //GameObject temp = Instantiate(Bolt); Bolt temp = boltPool.GetFromPool(); temp.gameObject.SetActive(true); temp.transform.position = BoltPos.position; temp.transform.localScale = boltSize; currentRate = FireRate; soundControl.PlayerEffectSound((int)eSoundEffect.shotPlayer); } currentRate -= Time.deltaTime; }
static void Main(string[] args) { // 思路:先随机拿起一个螺丝(枢轴),与所有的螺母比较,找到合适的那一个 // 再用找到的螺母与其他螺丝比较,将他们分为较大和较小两部分。 Bolt <int>[] bolts = new Bolt <int> [10]; Nut <int>[] nuts = new Nut <int> [10]; for (int i = 0; i < 10; i++) { bolts[i] = new Bolt <int>(i); nuts[i] = new Nut <int>(i); } BoltsAndNuts sort = new BoltsAndNuts(); sort.Sort(bolts, nuts); for (int i = 0; i < 10; i++) { Console.Write(bolts[i].Value + " "); } Console.WriteLine(); for (int i = 0; i < 10; i++) { Console.Write(nuts[i].Value + " "); } Console.WriteLine(); }
public async void ExecuteSerialBegin_Click(object sender, EventArgs e) { OperationsPanel.Enabled = false; CredentialsPanel.Enabled = false; Response.Text = "Waiting for response.."; Status.Text = "Executing.."; Bolt myBolt = new Bolt(ApiKey.Text.Trim(), DeviceId.Text.Trim()); BaudRates baudRate = 0; switch (BaudRateSel.SelectedIndex) { case 0: baudRate = BaudRates.Baud2400; break; case 1: baudRate = BaudRates.Baud4800; break; case 2: baudRate = BaudRates.Baud9600; break; case 3: baudRate = BaudRates.Baud19200; break; } RequestURL.Text = BuildRequestUrl("serialBegin", new List <string> { "baud" }, new List <string> { ((int)baudRate).ToString() }); Response response = await myBolt.SerialBegin(baudRate); Response.Text = response.ResponseString; Status.Text = "Ready"; OperationsPanel.Enabled = true; CredentialsPanel.Enabled = true; }
static void Main(string[] args) { Transportation.Train.Wheel.Bolt x = new Transportation.Train.Wheel.Bolt(); Bolt y = new Bolt(); Transportation.Bicycle.Wheel.Screw z = new Transportation.Bicycle.Wheel.Screw(); }
private void Fire() { float startX = (1 - mBoltCount) / 2f * mBoltGap; Vector3 pos = mBoltPos.position; pos.x += startX; for (int i = 0; i < mBoltCount; i++) { Bolt newBolt = mPool.GetFromPool(); newBolt.SetTargetTag("Enemy"); newBolt.transform.position = pos; pos.x += mBoltGap; } if (mSupporterFlag) { for (int i = 0; i < mSupporterBoltPosArr.Length; i++) { Bolt newBolt = mPool.GetFromPool(); newBolt.SetTargetTag("Enemy"); newBolt.transform.position = mSupporterBoltPosArr[i].position; } } mSoundController.PlayEffectSound((int)eSoundType.FirePlayer); }
// Update is called once per frame void Update() { float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical"); Vector3 direction = new Vector3(horizontal, 0, vertical); direction = direction.normalized; mRB.velocity = direction * mSpeed; //transform.Translate(direction * Time.deltaTime); mRB.rotation = Quaternion.Euler(0, 0, horizontal * -mTilted); mRB.position = new Vector3(Mathf.Clamp(mRB.position.x, mXMin, mXMax), 0, Mathf.Clamp(mRB.position.z, mZMin, mZMax)); if (Input.GetButton("Fire1") && mCurrentFireLate >= mFireLate) { Bolt bolt = mBoltPool.GetFromPool(); bolt.gameObject.transform.position = mBoltPos.position; mCurrentFireLate = 0; } else { mCurrentFireLate += Time.deltaTime; } }
static async Task <string> Example12() { return(await Bolt.NewSession(async session => { var movie = new IMDBMovie { imdb = "tt0110912", released = 1994, tagline = "The lives of two mob hitmen, a boxer, a gangster's wife, and a pair of diner bandits intertwine in four tales of violence and redemption.", title = "Pulp Fiction" }; var parameters = new Neo4jParameters() .WithEntity("newMovie", movie); var cursor = await session.RunAsync(@" CREATE (movie:Movie $newMovie) RETURN movie", parameters); var createdMovie = await cursor.MapSingleAsync <IMDBMovie>(); return createdMovie.Dump(); })); }
private static async Task LoadMovies() { await Bolt.NewSession(async session => { await session.RunAsync(Query.CreateMovies); }); }
static async Task <string> Example5() { return(await Bolt.NewSession(async session => { var cursor = await session.RunAsync(@" MATCH (actor:Person) WITH actor ORDER BY actor.born LIMIT 2 MATCH (actor)-[:ACTED_IN]->(movie:Movie) WITH actor, movie ORDER BY movie.released DESC WITH actor, collect(movie) AS movies RETURN actor, head(movies) AS newestMovie"); var actorWithMovies = (await cursor.ToListAsync()) .Map((Person actor, Movie newestMovie) => new { Actor = actor, NewestMovie = newestMovie }).ToList(); return actorWithMovies.Dump(); })); }
public override string ToString() { StringBuilder __sb = new StringBuilder("ExecutorSpecificStats("); bool __first = true; if (Bolt != null && __isset.bolt) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Bolt: "); __sb.Append(Bolt == null ? "<null>" : Bolt.ToString()); } if (Spout != null && __isset.spout) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Spout: "); __sb.Append(Spout == null ? "<null>" : Spout.ToString()); } __sb.Append(")"); return(__sb.ToString()); }
static async Task <string> Example14() { return(await Bolt.NewSession(async session => { var cursor = await session.RunAsync(@" MATCH (movie:Movie {released: $year}) RETURN movie", new { year = 1999 }); var movies = await cursor.MapAsync <MovieEntity>(); var matrix = movies.Single(p => p.title == "The Matrix"); matrix.imdb = "tt0133093"; var updateParams = new Neo4jParameters() .WithEntity("updatedMovie", matrix) .WithValue("nodeId", matrix.id); cursor = await session.RunAsync(@" MATCH (movie) WHERE id(movie) = $nodeId SET movie = $updatedMovie RETURN movie", updateParams); var updatedMovie = await cursor.MapSingleAsync <MovieEntity>(); return updatedMovie.Dump(); })); }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("ExecutorSpecificStats"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Bolt != null && __isset.bolt) { field.Name = "bolt"; field.Type = TType.Struct; field.ID = 1; oprot.WriteFieldBegin(field); Bolt.Write(oprot); oprot.WriteFieldEnd(); } if (Spout != null && __isset.spout) { field.Name = "spout"; field.Type = TType.Struct; field.ID = 2; oprot.WriteFieldBegin(field); Spout.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
[TestCase(0.020, 0.022, 0.000245, 0.010, 410000, 0.040, 0.030, 0.0131, 410000, 0.09, null, 0.070, 0.140, 94.08)] //SCI P358, pg 42 Beam 1 //SCI P358, pg 38 public void CalculateShearResistance(double Diameter, double HoleDiameter, double TensileStressArea, double Member1Thickness, double Member1Ultimate, double?Member1MajorEdgeDistance, double?Member1MinorEdgeDistance, double Member2Thickness, double Member2Ultimate, double?Member2MajorEdgeDistance, double?Member2MinorEdgeDistance, double?MajorSpacing, double?MinorSpacing, double Result) { Bolt bolt = new Bolt(); bolt.Diameter = Diameter; bolt.HoleDiameter = HoleDiameter; bolt.TensileStressArea = TensileStressArea; bolt.Member1Thickness = Member1Thickness; bolt.Member1UltimateStrength = Member1Ultimate; bolt.Member1MajorEdgeDistance = Member1MajorEdgeDistance; bolt.Member1MinorEdgeDistance = Member1MinorEdgeDistance; bolt.Member2Thickness = Member2Thickness; bolt.Member2UltimateStrength = Member2Ultimate; bolt.Member2MajorEdgeDistance = Member2MajorEdgeDistance; bolt.Member2MinorEdgeDistance = Member2MinorEdgeDistance; bolt.MajorSpacing = MajorSpacing; bolt.MinorSpacing = MinorSpacing; bolt.Run(new OutputBuilder()); Assert.IsTrue(bolt.Calculated, "Calculation failed to complete successfully"); Assert.AreEqual(Result, bolt.ShearResistance, 0.1); }
public async void ExecuteSerialWriteRead_Click(object sender, EventArgs e) { OperationsPanel.Enabled = false; CredentialsPanel.Enabled = false; Response.Text = "Waiting for response.."; Status.Text = "Executing.."; Bolt myBolt = new Bolt(ApiKey.Text.Trim(), DeviceId.Text.Trim()); string till = SerialWriteReadTill.Value.ToString(); string data = SerialWriteReadData.Text.Trim(); RequestURL.Text = BuildRequestUrl("serialWR", new List <string> { "data", "till" }, new List <string> { Uri.EscapeUriString(data), till }); Response response = await myBolt.SerialWriteRead(data, till); Response.Text = response.ResponseString; Status.Text = "Ready"; OperationsPanel.Enabled = true; CredentialsPanel.Enabled = true; }
// Update is called once per frame void Update() { float horizontal = Input.GetAxis("Horizontal") * Speed; float vertical = Input.GetAxis("Vertical") * Speed; rb.velocity = new Vector3(horizontal, 0, vertical); rb.rotation = Quaternion.Euler(0, 0, horizontal * -rot); rb.position = new Vector3(Mathf.Clamp(rb.position.x, -5, 5), 0, Mathf.Clamp(rb.position.z, -4, 10)); currentFirerate -= Time.deltaTime; if (Input.GetButton("Shoot") && currentFirerate <= 0) { Bolt temp = Boltp.GetFromPool(); temp.transform.position = Boltpos.position; temp.transform.localScale = Vector3.one * boltSize; temp.gameObject.SetActive(true); currentFirerate = FireRate; soundControl.PlayEffectSound(eSoundEffectClip.shotPlayer); } if (powerUPTimer <= 0) { boltSize = 1; powerUPTimer = 0; } else { powerUPTimer -= Time.deltaTime; } }
private static async Task DeleteBondMovies() { await Bolt.NewAsyncSession(async session => { await session.RunAsync(Query.DeleteBond); }); }
public static dynamic GetTSObject(Bolt dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }
private void AutoFireInvoke() { Bolt newBolt = mBoltPool.GetFromPool(); newBolt.transform.position = mBoltPos.position; newBolt.transform.rotation = mBoltPos.rotation; mSoundController.PlayEffectSound((int)eSoundType.FireEnem); }
void OnTriggerEnter2D(Collider2D other) { Bolt bolt = other.gameObject.GetComponent(typeof(Bolt)) as Bolt; if (bolt != null && bolt.sideFriend) { Damage(bolt.damage); Destroy(other.gameObject); } }
void Fire() { if (!firstMove) { foreach (Transform cann in Cannon) { Bolt bolt = Instantiate(shot, cann.position, cann.rotation); bolt.sideEnemy = true; } } }
public SewingRecipe(Bolt one, Bolt two, Stitch stitch, Bolt three, Stitch stitch2) { this.item1 = one; this.item2 = two; this.firstStitch = stitch; this.item3 = three; this.secondStitch = stitch2; }
private IEnumerator AutoFire() { while (true) //while function used because it wants to function the insided script to work infinitly //IEumerator functions only once { yield return(new WaitForSeconds(Random.Range(0.7f, 1.2f))); Bolt bolt = mPool.GetFromPool(); bolt.transform.position = BoltPos.position; soundController.PlayEffectSound((int)eEffectSoundType.FireEnemy); } }
public override void ConnectRefused(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token) { title = "Connection Refused"; if (token != null && token is DisconnectReason) { DisconnectReason reason = (DisconnectReason)token; messageBody = reason.Reason + (reason.Message == "" ? "" : ": " + reason.Message); } else { messageBody = "Unknown Error"; } messageDisplayed = true; }
private static async Task LoadBondMovies() { await Bolt.NewAsyncSession(async session => { var queryParts = Query.CreateBond.Split(';'); foreach (var queryPart in queryParts) { await session.RunAsync(queryPart); } }); }
private IEnumerator AutoFire() { while (true) { yield return(new WaitForSeconds(Random.Range(0.7f, 1.2f))); Bolt bolt = mPool.GetFromPool(); bolt.transform.position = BoltPos.position; soundController.PlayEffectSound((int)eEffectSoundType.FireEnemy); } }
private IEnumerator AutoFire(float time) { while (time > 0) { Bolt newBolt = boltPool.GetFromPool(); newBolt.transform.position = FirePos.position; soundController.PlayEffectSound((int)eEffectSoundType.FireEnemy); time = time - 0.3f; yield return(new WaitForSeconds(0.3f)); } }
void Update() { if (Input.GetButton("Fire1") && Time.time > nextFire) { nextFire = Time.time + fireRate; GameObject boltObject = Instantiate(shot, shotSpawn.position, shotSpawn.rotation); Bolt bolt = boltObject.GetComponent <Bolt>(); bolt.SetOnChargeUpAction(IncreaseCharge); GetComponent <AudioSource>().Play(); } }
static async Task <string> Example8() { return(await Bolt.NewSession(async session => { var cursor = await session.RunAsync(@"RETURN { temporalValue: datetime() } as map"); var customType = (await cursor.SingleAsync()) .Map <Example8CustomType>(); return customType.Dump(); })); }
public override bool NextPortStatusChange(out Bolt.INatDevice device, out Bolt.IPortMapping mapping) { lock (syncLock) { if (portChanges.Count > 0) { var change = portChanges.Dequeue(); device = change.Device; mapping = change.Mapping; return true; } else { device = null; mapping = null; return false; } } }
public BoltProblemSolver(int size) { this.Size = size; this.ProblemBolts = new Bolt[Size]; this.ProblemNuts = new Nut[Size]; this.rand = new Random(); for (int i=0; i<Size;i++) { ProblemBolts[i] = new Bolt(i); ProblemNuts[i] = new Nut(i); } // Randomize Lists ProblemNuts = ProblemNuts.OrderBy(x => rand.Next()).ToArray(); ProblemBolts = ProblemBolts.OrderBy(x => rand.Next()).ToArray(); }
public override void BoltShutdownBegin(Bolt.AddCallback registerDoneCallback) { base.BoltShutdownBegin(registerDoneCallback); UnityEngine.Debug.Log("bolt shutdown begin"); try { BoltNetwork.DisableLanBroadcast(); } catch(Exception e) { UnityEngine.Debug.LogException(e); } if(null != OnShutdownBegin) { OnShutdownBegin.Invoke(); OnShutdownBegin = null; } registerDoneCallback(onShutdown); }
public virtual void SimpleMethodWithComplexParameter(Bolt.Test.Common.CompositeType compositeType) { this.Send(__SimpleMethodWithComplexParameterAction, compositeType); }
public void Read (TProtocol iprot) { bool isset_spouts = false; bool isset_bolts = false; bool isset_state_spouts = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Map) { { Spouts = new Dictionary<string, SpoutSpec>(); TMap _map22 = iprot.ReadMapBegin(); for( int _i23 = 0; _i23 < _map22.Count; ++_i23) { string _key24; SpoutSpec _val25; _key24 = iprot.ReadString(); _val25 = new SpoutSpec(); _val25.Read(iprot); Spouts[_key24] = _val25; } iprot.ReadMapEnd(); } isset_spouts = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Map) { { Bolts = new Dictionary<string, Bolt>(); TMap _map26 = iprot.ReadMapBegin(); for( int _i27 = 0; _i27 < _map26.Count; ++_i27) { string _key28; Bolt _val29; _key28 = iprot.ReadString(); _val29 = new Bolt(); _val29.Read(iprot); Bolts[_key28] = _val29; } iprot.ReadMapEnd(); } isset_bolts = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Map) { { State_spouts = new Dictionary<string, StateSpoutSpec>(); TMap _map30 = iprot.ReadMapBegin(); for( int _i31 = 0; _i31 < _map30.Count; ++_i31) { string _key32; StateSpoutSpec _val33; _key32 = iprot.ReadString(); _val33 = new StateSpoutSpec(); _val33.Read(iprot); State_spouts[_key32] = _val33; } iprot.ReadMapEnd(); } isset_state_spouts = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_spouts) throw new TProtocolException(TProtocolException.INVALID_DATA); if (!isset_bolts) throw new TProtocolException(TProtocolException.INVALID_DATA); if (!isset_state_spouts) throw new TProtocolException(TProtocolException.INVALID_DATA); }
private Nut findMatchingNut(Bolt bolt, List<Nut> nuts) { return nuts.Where(nut => nut.Size == bolt.Size).ToArray()[0]; }
public TestContractStateFullProxy(Bolt.Server.IntegrationTest.Core.TestContractStateFullProxy proxy) : base(proxy) { }
public TestContractStateFullProxy(Bolt.Pipeline.IPipeline<ClientActionContext> channel) : base(typeof(Bolt.Server.IntegrationTest.Core.ITestContractStateFull), channel) { }
public virtual Task SimpleMethodWithComplexParameterAsync(Bolt.Test.Common.CompositeType compositeType) { return this.SendAsync(__SimpleMethodWithComplexParameterAction, compositeType); }
void UpdatePort(Bolt.NatPortMappingStatus status, int port) { if (port < 1 || port > ushort.MaxValue) { throw new System.ArgumentOutOfRangeException("port"); } lock (syncLock) { NatPortMapping mapping = new NatPortMapping { Status = status, Internal = port, External = port }; if (portList.ContainsKey(port)) { portList.Remove(port); } portList.Add(port, mapping); } }
public override void ConnectFailed(UdpKit.UdpEndPoint endpoint, Bolt.IProtocolToken token) { base.ConnectFailed(endpoint, token); sendResult(false); }
public BoltNode(Bolt bolt , Nut nut) { this.bolt = bolt; this.nut = nut; }
public virtual Task MethodWithNotSerializableTypeAsync(Bolt.Test.Common.NotSerializableType arg) { return this.SendAsync(__MethodWithNotSerializableTypeAction, arg); }
public override void BoltShutdownBegin(Bolt.AddCallback registerDoneCallback) { SMUtils.log("bolt shutdown begin"); }
public virtual void MethodWithManyArguments(Bolt.Test.Common.CompositeType arg1, Bolt.Test.Common.CompositeType arg2, DateTime time) { this.Send(__MethodWithManyArgumentsAction, arg1, arg2, time); }
public virtual void MethodWithNotSerializableType(Bolt.Test.Common.NotSerializableType arg) { this.Send(__MethodWithNotSerializableTypeAction, arg); }
public virtual Task MethodWithManyArgumentsAsync(Bolt.Test.Common.CompositeType arg1, Bolt.Test.Common.CompositeType arg2, DateTime time) { return this.SendAsync(__MethodWithManyArgumentsAction, arg1, arg2, time); }