void Update() { if (Input.GetKey(KeyCode.Space)) { if (force < 101) { force++; forceSlider.fillAmount = force / 100; } if (force == 100) { for (int i = 101; i > 0; i--) { force = i; forceSlider.fillAmount = force / 100; } } } if (Input.GetKeyUp(KeyCode.Space)) { strike = new Strike(balls); if (!strike.isMoving) { ball.velocity = playerCamera.transform.forward * force / 2; force = 0; forceSlider.fillAmount = force; } } if (strike != null) { strike.checkMovement(); } updateScore(); }
public HeroSystemCharacter LoadBaseCharacter() { HeroSystemCharacter baseChar = new HeroSystemCharacter("Default Character"); // HeroSystemCharacter baseChar = new HeroSystemCharacter("Default Character", TableTopCharacterRepository); baseChar.STR.MaxValue = 10; baseChar.CON.MaxValue = 10; baseChar.DEX.MaxValue = 10; baseChar.BOD.MaxValue = 10; baseChar.PRE.MaxValue = 10; baseChar.INT.MaxValue = 10; baseChar.EGO.MaxValue = 10; baseChar.COM.MaxValue = 10; baseChar.PD.MaxValue = 2; baseChar.ED.MaxValue = 2; baseChar.SPD.MaxValue = 2; baseChar.STUN.MaxValue = 20; baseChar.END.MaxValue = 20; baseChar.DCV.MaxValue = 3; baseChar.OCV.MaxValue = 3; baseChar.RPD.MaxValue = 10; baseChar.RED.MaxValue = 10; Attack strike = new Strike(baseChar); return(baseChar); }
protected override void UpdateFrameOutcome(Queue <int> rolls) { if (_pinsRemaining == 0) { if (Turns.Count < _maxTurns) { FrameOutcome = new Strike(); } else { FrameOutcome = new Spare(); } } else { if (Turns.Count < _maxTurns) { PlayFrame(rolls); } else { FrameOutcome = new OpenFrame(); } } }
public override void Execute(IDataContext context) { ContextQuery = ctx => { var user = ctx.AsQueryable <User>().SingleOrDefault(t => t.Id == UserId); if (user == null) { throw new DomainException($"User with Id '{UserId}' could not be found"); } var moderator = ctx.AsQueryable <User>().SingleOrDefault(t => t.Id == ModeratorId); if (moderator == null) { throw new DomainException($"Moderator with Id '{ModeratorId}' could not be found"); } var player = ctx.AsQueryable <Player>() .Include(p => p.PlayerLogs) .SingleOrDefault(p => p.User.Id == UserId); if (player != null) { player.AddLog($"<b class='bad'>You have received a strike against your account from a moderator. Reason cited: {Reason}.</b>", true); } var entry = Strike.Create(user, moderator, Reason, Round); ctx.Add(entry); ctx.Commit(); }; ExecuteInternal(context); }
public void StrikeS() { using (MemoryStream mem = new MemoryStream()) { WordDocument doc = new WordDocument(mem); doc.Process(new HtmlParser("<s>test</s>")); Assert.IsNotNull(doc.Document.Body); Assert.AreEqual(1, doc.Document.Body.ChildElements.Count); Paragraph para = doc.Document.Body.ChildElements[0] as Paragraph; Assert.IsNotNull(para); Assert.AreEqual(1, para.ChildElements.Count); Run run = para.ChildElements[0] as Run; Assert.IsNotNull(run); Assert.AreEqual(2, run.ChildElements.Count); RunProperties properties = run.ChildElements[0] as RunProperties; Assert.IsNotNull(properties); Assert.AreEqual(1, properties.ChildElements.Count); Strike strike = properties.ChildElements[0] as Strike; Assert.IsNotNull(strike); Word.Text text = run.ChildElements[1] as Word.Text; Assert.IsNotNull(text); Assert.AreEqual("test", text.InnerText); OpenXmlValidator validator = new OpenXmlValidator(); var errors = validator.Validate(doc.WordprocessingDocument); Assert.AreEqual(0, errors.Count()); } }
public void TOATest() { DetectionInstance strike1 = new DetectionInstance() { DetectorLat = (float)153.221, DetectorLon = (float)-27.5604, DetectionTime = 0 }; DetectionInstance strike2 = new DetectionInstance() { DetectorLat = (float)153.265, DetectorLon = (float)-27.5583, DetectionTime = 0 }; DetectionInstance strike3 = new DetectionInstance() { DetectorLat = (float)153.24211, DetectorLon = (float)-27.5241, DetectionTime = 0 }; var strikedetections = new System.Collections.Generic.List <DetectionInstance> { strike1, strike2, strike3 }; Strike final = TOACorrelator.Correlate(strikedetections); Assert.IsNotNull(final); }
public static void AddStrike(ulong user, DateTime time, TimeSpan span, string strikeReason) { if (strikes.ContainsKey(user)) { strikes [user].strikeTime.Add(span); strikes [user].reason += ", " + strikeReason; } else { Strike newStrike = new Strike() { reason = strikeReason, strikeDate = time, strikeTime = span }; strikes.Add(user, newStrike); // Well these names are not confusing. I suppose this is why we make constructors. } SocketGuildUser socketUser = Utility.GetServer().GetUser(user); SocketRole role = GetRole(); if (!socketUser.Roles.Contains(role)) { Utility.SecureAddRole(socketUser, role); } Program.messageControl.SendMessage(socketUser, strikeGivenMessage.Replace("{STRIKEREASON}", strikeReason).Replace("{STRIKERAISEDATE}", strikes[user].strikeDate.Add(strikes[user].strikeTime).ToString())); AutoCommands.RunEvent(AutoCommands.Event.UserStricken, user.ToString(), time.ToString(), strikeReason); Save(); }
public void CheckReportCreation(string text, string expected) { Strike testObject = new Strike(text); string actual = testObject.Create(); Assert.Equal(expected, actual); }
void onZeroHealth() { Strike strike = mStrikeManager.getNext() as Strike; strike.activate(transform.position, mStrikeManager); deactivate(); }
public void SpawnStrike(Vector3 start, Vector3 end) { Strike strike = getFreeStrike(); Vector3 direction = end - start; int steps = (int)Mathf.Clamp(Mathf.Ceil(direction.magnitude * strikeStep), 1, float.MaxValue); float stepLength = direction.magnitude / steps; Debug.Log($"strike: steps = {steps}, stepLength = {stepLength}"); Vector3[] pos = new Vector3[steps + 1]; Vector3[] dev = new Vector3[steps + 1]; pos[0] = start; for (int i = 1; i < pos.Length; i++) { Vector3 rnd = Random.insideUnitCircle * maxDeviation; dev[i] = rnd; pos[i] = start + direction.normalized * stepLength * i; } strike.line.positionCount = pos.Length; strike.line.SetPositions(pos); strike.steps = pos; strike.deviation = dev; strike.go.transform.position = start; strike.go.SetActive(true); strike.lifetime = 0; }
public void TestVolSurface() { IVolatilitySurface volSurface = new VolatilitySurface("BHP", 4500M, DateTime.Today); ForwardExpiry expiry1 = new ForwardExpiry(DateTime.Parse("01-Jan-2010"), 4200); ForwardExpiry expiry2 = new ForwardExpiry(DateTime.Parse("01-Jan-2011"), 4400); OptionPosition call1 = new OptionPosition("1245", 104, PositionType.Call); OptionPosition put1 = new OptionPosition("1246", 1200, PositionType.Put); OptionPosition call2 = new OptionPosition("1645", 180, PositionType.Call); OptionPosition put2 = new OptionPosition("1646", 1300, PositionType.Put); Strike strike1 = new Strike(4200, call1, put1); Strike strike2 = new Strike(4000, call2, put2); IVolatilityPoint point1 = new VolatilityPoint(); point1.SetVolatility(0.30M, VolatilityState.Default()); put1.SetVolatility(point1); call1.SetVolatility(point1); IVolatilityPoint point2 = new VolatilityPoint(); point2.SetVolatility(0.40M, VolatilityState.Default()); call2.SetVolatility(point2); put2.SetVolatility(point2); expiry1.AddStrike(strike1, true); expiry2.AddStrike(strike2, false); volSurface.AddExpiry(expiry1); volSurface.AddExpiry(expiry2); List <ForwardExpiry> forwardExpiries = volSurface.NodalExpiries.ToList(); int n1 = forwardExpiries[0].Strikes.Count(item => item.NodalPoint); // int n2 = forwardExpiries[1].Strikes.Count(delegate(Strike item) { return item.NodalPoint == true; }); int n2 = 0; Assert.AreEqual(1, n1 + n2); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -1731780257: // yearFraction this.yearFraction = (double?)newValue.Value; break; case -891985998: // strike this.strike = (Strike)newValue; break; case 1005147787: // currencyPair this.currencyPair = (CurrencyPair)newValue; break; case 102727412: // label this.label = (string)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public Enumerations.OUTCOME Strike([FromUri] int id, [FromBody] Strike strike) { if (Game.Instance.State == Enumerations.GAMESTATE.Playing) { return(Game.Instance.StrikePlayer(id, strike)); } throw new InvalidOperationException("You can only attack your opponent once the game is in PLAYING state. Please wait for making a new attempt."); }
Strike createStrike() { var go = Instantiate(prefab, transform); Strike strike = new Strike(go); activeList.Add(strike); return(strike); }
private GenericVolatilitySurfacePeriodParameterMetadata(Period period, Strike strike, string label) { JodaBeanUtils.notNull(strike, "strike"); JodaBeanUtils.notEmpty(label, "label"); this.period = period; this.strike = strike; this.label = label; }
private GenericVolatilitySurfaceYearFractionParameterMetadata(double yearFraction, Strike strike, string label) { JodaBeanUtils.notNull(strike, "strike"); JodaBeanUtils.notEmpty(label, "label"); this.yearFraction = yearFraction; this.strike = strike; this.label = label; }
/// <summary> /// Creates the strike. /// </summary> /// <param name="style">The style.</param> /// <param name="price">The price.</param> /// <returns></returns> static public Strike CreateStrike(OptionType style, Double price) { Strike strike = new Strike(style, price); Assert.AreEqual(strike.Style, style); Assert.AreEqual(strike.StrikePrice, price); return(strike); }
private FxVolatilitySurfaceYearFractionParameterMetadata(double yearFraction, Strike strike, CurrencyPair currencyPair, string label) { JodaBeanUtils.notNull(strike, "strike"); JodaBeanUtils.notNull(currencyPair, "currencyPair"); JodaBeanUtils.notEmpty(label, "label"); this.yearFraction = yearFraction; this.strike = strike; this.currencyPair = currencyPair; this.label = label; }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns> public override int GetHashCode() { unchecked { var hashCode = (int)OptionType; hashCode = (hashCode * 397) ^ BaseNotional.GetHashCode(); hashCode = (hashCode * 397) ^ Strike.GetHashCode(); hashCode = (hashCode * 397) ^ Maturity.GetHashCode(); return(hashCode); } }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(FxOptionVolatilitiesNode beanToCopy) { this.currencyPair_Renamed = beanToCopy.CurrencyPair; this.label_Renamed = beanToCopy.Label; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; this.businessDayAdjustment_Renamed = beanToCopy.BusinessDayAdjustment; this.expiryDateOffset_Renamed = beanToCopy.ExpiryDateOffset; this.quoteValueType_Renamed = beanToCopy.QuoteValueType; this.quoteId_Renamed = beanToCopy.QuoteId; this.tenor_Renamed = beanToCopy.Tenor; this.strike_Renamed = beanToCopy.Strike; }
public void CharacterMoving_MustContinueToUseMovementUntilCharacterIsAbleToFullyDecelerate() { FlightManuever.Perform(); Flight.MoveCharacter(100); Strike s = Character.Manuevers["Strike"] as Strike; ; Assert.AreEqual(false, s.CanPerform); Assert.AreEqual(1, Character.AllowedManuevers.Count); FlightManuever.Perform(); Flight.StopMovingCharacter(); }
public override int GetHashCode() { var hashCode = -1593953530; hashCode = hashCode * -1521134295 + Name.GetHashCode(); hashCode = hashCode * -1521134295 + Size.GetHashCode(); hashCode = hashCode * -1521134295 + Color.GetHashCode(); hashCode = hashCode * -1521134295 + Bold.GetHashCode(); hashCode = hashCode * -1521134295 + Italic.GetHashCode(); hashCode = hashCode * -1521134295 + Strike.GetHashCode(); hashCode = hashCode * -1521134295 + UnderlineType.GetHashCode(); return(hashCode); }
protected override void SolveInstance(IGH_DataAccess DA) { string text = string.Empty; DA.GetData(0, ref text); string reportPart; Strike reportObject = new Strike(text); reportPart = reportObject.Create(); DA.SetData(0, reportPart); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + QuoteCurrency.GetHashCode(); hashCode = hashCode * 59 + Kind.GetHashCode(); if (TickSize != null) { hashCode = hashCode * 59 + TickSize.GetHashCode(); } if (ContractSize != null) { hashCode = hashCode * 59 + ContractSize.GetHashCode(); } if (IsActive != null) { hashCode = hashCode * 59 + IsActive.GetHashCode(); } hashCode = hashCode * 59 + OptionType.GetHashCode(); if (MinTradeAmount != null) { hashCode = hashCode * 59 + MinTradeAmount.GetHashCode(); } if (InstrumentName != null) { hashCode = hashCode * 59 + InstrumentName.GetHashCode(); } hashCode = hashCode * 59 + SettlementPeriod.GetHashCode(); if (Strike != null) { hashCode = hashCode * 59 + Strike.GetHashCode(); } hashCode = hashCode * 59 + BaseCurrency.GetHashCode(); if (CreationTimestamp != null) { hashCode = hashCode * 59 + CreationTimestamp.GetHashCode(); } if (ExpirationTimestamp != null) { hashCode = hashCode * 59 + ExpirationTimestamp.GetHashCode(); } return(hashCode); } }
public void Execute(Strike strike) { Debug.Log("Execute", transform); lastStrike = strike; cameraController.RequestCamera(CameraController.CameraType.Watch); createStrike.enabled = false; strikeRenderer.enabled = false; ReplayButton.SetActive(false); strikeResolver.Resolve(StrikeResolver.ResolverType.Strike, lastStrike); }
/// <summary> /// Ares the no ET os. /// </summary> /// <param name="stock">The stock.</param> /// <returns></returns> private Boolean AreNoETOs(IStock stock) { foreach (ForwardExpiry expiry in stock.VolatilitySurface.Expiries) { var strikes = new List <Strike>(expiry.Strikes); Strike match = strikes.Find(strikeItem => strikeItem.Volatility.Value > 0 ); if (match != null) { return(false); } } return(true); }
public void CharacterWithSightAndOtherCharacterTarget() { Character = Factory.BaseCharacter; Character.OCV.MaxValue = 4; Character.DCV.MaxValue = 4; Target = Factory.BaseCharacter; Sight = Character.CharacterSenses.Sight; Hearing = Character.CharacterSenses.Hearing; Touch = Character.CharacterSenses.Touch; CharacterSenses = Character.CharacterSenses; Strike = Character.Manuevers["Strike"] as Strike; Ranged = Factory.AddRangedAttackToCharacter(Character); CharacterSenses.Target = Target; }
public void CharacterPerformsHalfPhaseCombatManuever_CharacterPhaseIsOver() { CombatSequence sequence = Factory.SequenceWithFastMediumAndSlowCharacters; sequence.StartCombat(); Phase attacking = sequence.ActivePhase; Strike strike = attacking.Character.Manuevers["Strike"] as Strike; strike.Target(sequence.NextCombatPhase.Character); strike.Perform(); Assert.AreNotEqual(attacking, sequence.ActivePhase); }
public void StrikeTest() { List <int> balls = new List <int>(); Strike frame = new Strike(); frame.AddBalls(ref balls); balls.Add(2); balls.Add(3); Assert.Equal(15, frame.Score); Assert.Equal <int>(new int[] { 10 }, frame.PinsPerBall); Assert.Equal <int>(new int[] { 10, 2, 3 }, balls); }
public Task OnMinutePassed(DateTime time) { int count = strikes.Count; for (int i = 0; i < count; i++) { KeyValuePair <ulong, Strike> strike = strikes.ElementAt(0); Strike s = strike.Value; if (s.strikeDate.Add(s.strikeTime) < time) { RaiseStrike(strike.Key); } } return(Task.CompletedTask); }
public static IList<IFrame> GetAllFramesAsStrikes() { var frames = new List<IFrame>(); IFrame previousFrame = null; for (var i = 0; i < 10; i++) { var frame = new Strike(i + 1, previousFrame); frames.Add(frame); previousFrame = frame; } frames.Add(new BonusFrame(10, 10, 11, previousFrame)); return frames; }