public override BLRunStatus Run(BulletMLBullet bullet) { BLType blType = node.Type; float value = (float)(node.GetValue(this) * Math.PI / 180); if (blType == BLType.Sequence) { bullet.Direction = bullet.GetFireData().SourceDirection + value; } else if (blType == BLType.Absolute) { bullet.Direction = value; } else if (blType == BLType.Relative) { bullet.Direction = bullet.Direction + value; } else //if (blType == BLType.Aim || blType == BLType.None) { bullet.Direction = bullet.GetAimDir() + value; } //Debug.WriteLine(String.Format("SetDirecton:{0}, (type:{1} val:{2})", bullet.Direction / Math.PI * 180, node.type, value / Math.PI * 180)); End = true; return(BLRunStatus.End); }
public static IAsyncTariffCalculator GetTariffCalculator(BLType type = BLType.Simple) { IAsyncTariffCalculator calculator; if (!dictionary.TryGetValue(type, out calculator)) { switch (type) { case BLType.Simple: calculator = new SimpleTariffCalculator(); break; case BLType.WebService: calculator = new WebServiceTariffCalculator(); break; case BLType.Db: calculator = new DbTariffCalculator(); break; default: throw new ArgumentException("Invalid BLType"); } dictionary[type] = calculator; } return(calculator); }
public SimpleTariffForm() { InitializeComponent(); BLType type = (BLType)Enum.Parse(typeof(BLType), ConfigurationManager.AppSettings["BLType"]); tariffCalculator = BLFactory.GetTariffCalculator(type); }
public override BLRunStatus Run(BulletMLBullet bullet) { if (first) { first = false; float value = (float)(node.GetChildValue(BLName.Direction, this) * Math.PI / 180); blType = node.GetChild(BLName.Direction).Type; if (blType == BLType.Sequence) { changeDir = value; } else { if (blType == BLType.Absolute) { changeDir = (float)((value - bullet.Direction)); } else if (blType == BLType.Relative) { changeDir = (float)(value); } else { changeDir = (float)( (bullet.GetAimDir() + value - bullet.Direction)); } if( changeDir > Math.PI ) changeDir -= 2*(float)Math.PI; if( changeDir < -Math.PI ) changeDir += 2*(float)Math.PI; changeDir /= term; /* float finalDir = 0; if (blType == BLType.Absolute) { finalDir = value; } else if (blType == BLType.Relative) { finalDir = bullet.Direction + value; } else { finalDir = bullet.GetAimDir() + value; } // 角度の小さいほうへ回転する float changeDir1 = finalDir - bullet.Direction; float changeDir2; changeDir2 = changeDir1 > 0 ? changeDir2 = changeDir1 - 360: changeDir2 = changeDir1 + 360; changeDir = Math.Abs(changeDir1) < Math.Abs(changeDir2) ? changeDir1 : changeDir2; changeDir = changeDir / term; */ } } term--; bullet.Direction = bullet.Direction + changeDir; // if (bullet.index == DISP_BULLET_INDEX) Debug.WriteLine(String.Format("changeDirection:{0}度 (changeDir:{1} type:{2})", bullet.Direction / Math.PI * 180, changeDir, node.GetChild(BLName.Direction).type)); if (term <= 0) { End = true; return BLRunStatus.End; } else return BLRunStatus.Continue; }
public override BLRunStatus Run(BulletMLBullet bullet) { if (first) { first = false; float value = (float)(node.GetChildValue(BLName.Direction, this) * Math.PI / 180); blType = node.GetChild(BLName.Direction).type; if (blType == BLType.Sequence) { changeDir = value; } else { if (blType == BLType.Absolute) { changeDir = (float)((value - bullet.Direction)); } else if (blType == BLType.Relative) { changeDir = (float)(value); } else { changeDir = (float)((bullet.GetAimDir() + value - bullet.Direction)); } if (changeDir > Math.PI) { changeDir -= 2 * (float)Math.PI; } if (changeDir < -Math.PI) { changeDir += 2 * (float)Math.PI; } changeDir /= term; /* * float finalDir = 0; * * if (blType == BLType.Absolute) * { * finalDir = value; * } * else if (blType == BLType.Relative) * { * finalDir = bullet.Direction + value; * } * else * { * finalDir = bullet.GetAimDir() + value; * } * * // 角度の小さいほうへ回転する * float changeDir1 = finalDir - bullet.Direction; * float changeDir2; * changeDir2 = changeDir1 > 0 ? changeDir2 = changeDir1 - 360: changeDir2 = changeDir1 + 360; * changeDir = Math.Abs(changeDir1) < Math.Abs(changeDir2) ? changeDir1 : changeDir2; * changeDir = changeDir / term; */ } } term--; bullet.Direction = bullet.Direction + changeDir; // if (bullet.index == DISP_BULLET_INDEX) Debug.WriteLine(String.Format("changeDirection:{0}度 (changeDir:{1} type:{2})", bullet.Direction / Math.PI * 180, changeDir, node.GetChild(BLName.Direction).type)); if (term <= 0) { end = true; return(BLRunStatus.End); } else { return(BLRunStatus.Continue); } }