Exemplo n.º 1
0
        public void Communicate(Widget w, string reason, Action a)
        {
            if (shared == null)
            {
                return;
            }

            if (ConnectivityManager.HasConnectionToControl(shared.Vessel))
            {
                var mdelay = ConnectivityManager.GetDelayToControl(shared.Vessel) + extraDelay;
                if (mdelay > 0.1 || extraDelay > 0)
                {
                    var newat = new ActionTime(w, reason, a, shared.UpdateHandler.CurrentTime + mdelay);
                    // Linear insert because almost always it will be added at the end
                    // Only if FTL travel or if new pathways come online will it not.
                    int index = delayedActions.Count;
                    while (index - 1 >= 0 && delayedActions[index - 1].time > newat.time)
                    {
                        index--;
                    }
                    delayedActions.Insert(index, newat);
                }
                else
                {
                    a();
                }
            }
        }
Exemplo n.º 2
0
        public override void Update(BaseScene scene, FrameTick elapsedTime)
        {
            base.Update(scene, elapsedTime);

            //x = c + b*t + a*(t^2)/2
            locHeight = StartHeight + HeightSpeed * ActionTime.ToFrames() / GraphicsManager.MAX_FPS + HeightAcceleration * ActionTime.ToFrames() * ActionTime.ToFrames() / GraphicsManager.MAX_FPS / GraphicsManager.MAX_FPS / 2;
            mapLoc    = StartLoc + Speed * ActionTime.ToFrames() / GraphicsManager.MAX_FPS + Acceleration * ActionTime.ToFrames() * ActionTime.ToFrames() / GraphicsManager.MAX_FPS / GraphicsManager.MAX_FPS / 2;
        }
Exemplo n.º 3
0
 protected override void UpdateFrameInternal()
 {
     MapLoc = AnimLoc * GraphicsManager.TileSize;
     if (ActionTime.FractionOf(2, ANIM_TIME) % 2 == 0)
     {
         drawOffset = drawOffset + CharDir.Reverse().GetLoc();
     }
 }
Exemplo n.º 4
0
Arquivo: Stop.cs Projeto: Fankine/Zero
 public Stop()
 {
     Name              = "Stop";
     Power             = 0;
     ScreenShakePower  = 0;
     ActionTime        = new ActionTime(10, 10, 10);
     Target            = Target.None;
     ClassRestrictions = new List <IHeroClass>();
 }
Exemplo n.º 5
0
 public Attack()
 {
     Name              = "Attack";
     Power             = 10;
     ScreenShakePower  = 0;
     ActionTime        = new ActionTime(10, 10, 10);
     Target            = Target.Forward;
     ClassRestrictions = new List <IHeroClass>();
 }
Exemplo n.º 6
0
 public Parry()
 {
     Name              = "Parry";
     Power             = 40;
     ScreenShakePower  = 0;
     ActionTime        = new ActionTime(10, 10, 10);
     Target            = Target.Forward;
     ClassRestrictions = new List <IHeroClass>();
 }
Exemplo n.º 7
0
 public Jump()
 {
     Name              = "Jump";
     Power             = 1;
     ScreenShakePower  = 0;
     ActionTime        = new ActionTime(10, 10, 10);
     Target            = Target.Upward;
     ClassRestrictions = new List <IHeroClass>();
 }
Exemplo n.º 8
0
        public override void Update(BaseScene scene, FrameTick elapsedTime)
        {
            base.Update(scene, elapsedTime);

            int degrees = DegreesStart + (int)ActionTime.FractionOf(CycleSpeed, GraphicsManager.MAX_FPS);

            locHeight = StartHeight + (int)ActionTime.FractionOf(HeightSpeed, GraphicsManager.MAX_FPS);
            mapLoc    = Origin + GetCycle(Radius, Radius / 2, degrees);
            Direction = GetCycle(Radius, Radius / 2, degrees + 90 * (CycleSpeed < 0 ? -1 : 1)).ApproximateDir8();
        }
Exemplo n.º 9
0
        public void StartAction(Action action)
        {
            StopCurrentAction();

            var actionTime = new ActionTime(DateTime.Now, action.id);

            _log.Add(actionTime);

            logChanged.SafeInvoke();
        }
Exemplo n.º 10
0
 protected override string[] GetContent()
 {
     return(new[]
     {
         ID.ToString(),
         ActionTime.ToString(),
         m_actionsName[Action],
         AppContext.TableManager.GetTable(TableID).Name,
         RowID.ToString()
     });
 }
Exemplo n.º 11
0
 protected override void UpdateFrameInternal()
 {
     if (ActionTime.DivOf(10) % 2 == 0)
     {
         drawOffset = drawOffset + CharDir.Reverse().GetLoc();
     }
     if (ActionTime.FractionOf(4, AnimTime) > 0)
     {
         opacity = 128;
     }
     MapLoc = AnimLoc * GraphicsManager.TileSize;
 }
Exemplo n.º 12
0
        public override IEnumerable <Loc> GetLocsVisible()
        {
            float diff = ActionTime.FractionOf(FINISH_TIME);

            if (diff > 0f)
            {
                yield return(ToLoc);
            }
            if (diff < 1f)
            {
                yield return(FromLoc);
            }
        }
Exemplo n.º 13
0
        public override IEnumerable <VisionLoc> GetVisionLocs()
        {
            float diff = ActionTime.FractionOf(ANIM_TIME);

            if (diff > 0f)
            {
                yield return(new VisionLoc(ToLoc, diff));
            }
            if (diff < 1f)
            {
                yield return(new VisionLoc(FromLoc, 1f - diff));
            }
        }
Exemplo n.º 14
0
 protected override void UpdateFrameInternal()
 {
     dirOffset = (Dir8)(ActionTime.FractionOf(8 * SPINS, ANIM_TIME) % 8);
     if (ActionTime < ANIM_TIME / 2)
     {
         LocHeight = (int)(ActionTime.FractionOf(GraphicsManager.TileSize * MAX_TILE_HEIGHT * 2, ANIM_TIME));
         MapLoc    = FromLoc * GraphicsManager.TileSize;
     }
     else
     {
         LocHeight = -(int)(ActionTime - ANIM_TIME).FractionOf(GraphicsManager.TileSize * MAX_TILE_HEIGHT * 2, ANIM_TIME);
         MapLoc    = ToLoc * GraphicsManager.TileSize;
     }
 }
Exemplo n.º 15
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = EventId?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (BeaconId?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ActionTime?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Location?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Trigger;
         hashCode = (hashCode * 397) ^ Delivered.GetHashCode();
         hashCode = (hashCode * 397) ^ Background.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 16
0
        protected override void UpdateFrameInternal()
        {
            if (FromLoc != ToLoc)
            {
                double maxDistance = Math.Sqrt(((FromLoc - ToLoc) * GraphicsManager.TileSize).DistSquared());
                LocHeight = AnimMath.GetArc(maxDistance / 2, ANIM_TIME, ActionTime.ToFrames());

                Loc diff = (ToLoc - FromLoc) * GraphicsManager.TileSize;
                diff   = new Loc((int)(diff.X * ActionTime.FractionOf(ANIM_TIME)), (int)(diff.Y * ActionTime.FractionOf(ANIM_TIME)));
                MapLoc = diff + FromLoc * GraphicsManager.TileSize;
            }
            else
            {
                MapLoc = FromLoc * GraphicsManager.TileSize;
            }
        }
Exemplo n.º 17
0
        public override void Update(BaseScene scene, FrameTick elapsedTime)
        {
            base.Update(scene, elapsedTime);

            //a=EndLoc - StartLoc
            //b=(-a.y, a.x)/||a||*r*||a||
            //b=(-a.y, a.x)*r
            //Va=t*a
            //Vb=4*b*t*(1-t)

            FrameTick midTime     = ActionTime;
            Loc       majorVector = EndLoc - StartLoc;
            Loc       minorVector = new Loc(-majorVector.Y, majorVector.X);
            Loc       majorDiff   = majorVector * ActionTime.ToFrames() / MovingTime;
            double    div         = Math.Sqrt(majorDiff.DistSquared());
            Loc       minorDiff   = 4 * minorVector * ActionTime.ToFrames() * (MovingTime - ActionTime.ToFrames()) / MovingTime / MovingTime;

            mapLoc = StartLoc + majorDiff + new Loc((int)(minorDiff.X * AxisRatio), (int)(minorDiff.Y * AxisRatio));
        }
Exemplo n.º 18
0
 public override IEnumerable <VisionLoc> GetVisionLocs()
 {
     if (ActionTime < ANIM_TIME)
     {
         float diff = ActionTime.FractionOf(ANIM_TIME);
         if (diff > 0f)
         {
             yield return(new VisionLoc(ToLoc, diff));
         }
         if (diff < 1f)
         {
             yield return(new VisionLoc(FromLoc, 1f - diff));
         }
     }
     else
     {
         yield return(new VisionLoc(RecoilLoc, 1f));//or maybe the diff from ToLoc to RecoilLoc
     }
 }
Exemplo n.º 19
0
        protected override void UpdateFrameInternal()
        {
            int totalTime = ANIM_TIME;

            if (ActionTime < totalTime)
            {
                double intb = (double)ActionTime.FractionOf(totalTime);
                MapLoc = new Loc(AnimMath.Lerp(FromLoc.X * GraphicsManager.TileSize, ToLoc.X * GraphicsManager.TileSize, intb),
                                 AnimMath.Lerp(FromLoc.Y * GraphicsManager.TileSize, ToLoc.Y * GraphicsManager.TileSize, intb));
                double maxDistance = Math.Sqrt(((FromLoc - ToLoc) * GraphicsManager.TileSize).DistSquared());
                LocHeight = AnimMath.GetArc(maxDistance / 2, ANIM_TIME, ActionTime.ToFrames());
            }
            else
            {
                double intb = (double)(ActionTime - totalTime).FractionOf(BOUNCE_TIME);
                MapLoc = new Loc(AnimMath.Lerp(ToLoc.X * GraphicsManager.TileSize, RecoilLoc.X * GraphicsManager.TileSize, intb),
                                 AnimMath.Lerp(ToLoc.Y * GraphicsManager.TileSize, RecoilLoc.Y * GraphicsManager.TileSize, intb));
                LocHeight = AnimMath.GetArc(GraphicsManager.TileSize / 2, FrameTick.FrameToTick(BOUNCE_TIME), (ActionTime - totalTime).Ticks);
            }
        }
Exemplo n.º 20
0
        protected override void UpdateFrameInternal()
        {
            int dist      = (FromLoc - ToLoc).Dist8();
            int totalTime = KNOCKBACK_TIME_PER_TILE * dist;

            if (ActionTime < totalTime)
            {
                double intb = (double)ActionTime.FractionOf(totalTime);
                MapLoc = new Loc(AnimMath.Lerp(FromLoc.X * GraphicsManager.TileSize, ToLoc.X * GraphicsManager.TileSize, intb),
                                 AnimMath.Lerp(FromLoc.Y * GraphicsManager.TileSize, ToLoc.Y * GraphicsManager.TileSize, intb));
                LocHeight = 0;
            }
            else
            {
                double intb = (double)(ActionTime - totalTime).FractionOf(BOUNCE_TIME);
                MapLoc = new Loc(AnimMath.Lerp(ToLoc.X * GraphicsManager.TileSize, RecoilLoc.X * GraphicsManager.TileSize, intb),
                                 AnimMath.Lerp(ToLoc.Y * GraphicsManager.TileSize, RecoilLoc.Y * GraphicsManager.TileSize, intb));
                LocHeight = AnimMath.GetArc(GraphicsManager.TileSize / 2, FrameTick.FrameToTick(BOUNCE_TIME), (ActionTime - totalTime).Ticks);
            }
        }
Exemplo n.º 21
0
        public async Task <IActionResult> GetAllActions()
        {
            User usr   = Functions.getUser(_cache); // get logged user
            var  data1 = await _db.ActionTypes.Where(a => a.UserId == usr.Id).ToListAsync();

            List <ActionTime> actionTimes = new List <ActionTime>();

            foreach (ActionType action in data1)
            {
                ActionTime actionTime = new ActionTime()
                {
                    Id     = action.Id,
                    Action = action.Action,
                    Date   = action.Time.ToString("dddd, dd MMMM yyyy HH:mm:ss"),
                    UserId = action.UserId
                };

                actionTimes.Add(actionTime);
            }
            return(Json(new { data = actionTimes.ToList() })); // return his actions
        }
Exemplo n.º 22
0
    private void AddActionTime(string action, float timeDelta, object[] parameters)
    {
        float      time = Time.time + timeDelta;
        ActionTime at   = new ActionTime(action, time, parameters);

        if (m_pendingActions.Count == 0)
        {
            m_pendingActions.Add(at);
        }
        else
        {
            int i = 0;
            for (; i < m_pendingActions.Count; i++)
            {
                if (m_pendingActions[i].time > time)
                {
                    break;
                }
            }
            m_pendingActions.Insert(i, at);
        }
    }
Exemplo n.º 23
0
 protected override void UpdateFrameInternal()
 {
     MapLoc    = AnimLoc * GraphicsManager.TileSize;
     LocHeight = (int)ActionTime.FractionOf(MAX_TILE_HEIGHT * GraphicsManager.TileSize, ANIM_TIME);
 }
Exemplo n.º 24
0
 public void GetCurrentSprite(CharSheet sheet, out int currentAnim, out int currentTime, out int currentFrame)
 {
     currentAnim  = AnimFrameType;
     currentTime  = ActionTime.ToFrames();
     currentFrame = sheet.GetCurrentFrame(AnimFrameType, DirExt.AddAngles(CharDir, dirOffset), FrameMethod);
 }
 public ScrollingDirective( ActionType nextActionType, ActionTime actionTime = HighlightModel.ActionTime.NextTick )
 {
     NextActionType = nextActionType;
     ActionTime = actionTime;
 }
Exemplo n.º 26
0
 protected override void UpdateFrameInternal()
 {
     MapLoc    = AnimLoc * GraphicsManager.TileSize;
     dirOffset = (Dir8)(ActionTime.FractionOf(8 * SPINS, ANIM_TIME) % 8);
 }
Exemplo n.º 27
0
 public void DoInRenderThread(Action action, ActionTime actionTime = ActionTime.BeforeFrame)
 {
     _actions.TryAdd(action, actionTime);
 }
Exemplo n.º 28
0
    private void AddActionTime(string action, float timeDelta, object[] parameters)
    {
        float time = Time.time + timeDelta;
        ActionTime at = new ActionTime(action, time, parameters);

        if (m_pendingActions.Count == 0)
        {
            m_pendingActions.Add(at);
        }
        else
        {
            int i = 0;
            for(; i < m_pendingActions.Count; i++)
            {
                if (m_pendingActions[i].time > time)
                    break;
            }
            m_pendingActions.Insert(i, at);
        }
    }