コード例 #1
0
        protected override void AddSprite(float dist, Rectangle bounds, Color c = default)
        {
            Vector2 origin = new Vector2(bounds.Width / 2f, bounds.Height / 2f);
            Vector2 angle  = new Vector2();
            Vector2 pos    = PositionLog.PositionAlongPath(dist, ref angle);
            float   r      = angle.ToRotation();

            spriteBatch.Draw(texture, pos - Main.screenPosition,
                             bounds, c == default ? lightColor : c, r,
                             origin, 1, GetEffects(r), 0);
            if (Main.rand.Next(20) == 0)
            {
                int dustId = Dust.NewDust(pos, bounds.Width, bounds.Height, dustType, 0f, 0f, 0, default, 2f);
コード例 #2
0
ファイル: PositionLogService.cs プロジェクト: DreamZoom/Magic
 /// <summary>
 /// 记录地理位置
 /// </summary>
 /// <param name="log"></param>
 /// <returns></returns>
 public PositionLog AddPosition(PositionLog log)
 {
     log.Latitude = Utility.Check.IsNullOrDefault(log.Latitude, 0);
     log.Longitude = Utility.Check.IsNullOrDefault(log.Longitude, 0);
     log.Speed = Utility.Check.IsNullOrDefault(log.Speed, 0);
     //log.Timestamp = Utility.Check.IsNullOrDefault(log.Timestamp, TimeSpan.Zero);
     log.Heading = Utility.Check.IsNullOrDefault(log.Heading, 0);
     log.Accuracy = Utility.Check.IsNullOrDefault(log.Accuracy, 0);
     log.Altitude = Utility.Check.IsNullOrDefault(log.Altitude, 0);
     log.AltitudeAccuracy = Utility.Check.IsNullOrDefault(log.AltitudeAccuracy, 0);
     log.AddTime = DateTime.Now;
     this.Add(log);
     return log;
 }