Example #1
0
        public void Update()
        {
            OnFrameUpdate.Invoke();

            if (FlightGlobals.ActiveVessel == null || FlightGlobals.ActiveVessel.packed)
            {
                return;
            }
            var vs = Satellites[FlightGlobals.ActiveVessel];

            if (vs != null)
            {
                GetLocks();
                if (vs.HasLocalControl)
                {
                    ReleaseLocks();
                }
                else if (vs.FlightComputer != null && vs.FlightComputer.InputAllowed)
                {
                    foreach (KSPActionGroup ag in GetActivatedGroup())
                    {
                        vs.FlightComputer.Enqueue(ActionGroupCommand.WithGroup(ag));
                    }
                }
            }
            else
            {
                ReleaseLocks();
            }
        }
Example #2
0
 public override void DidUpdateFrame(ARSession session, ARFrame frame)
 {
     using (frame)
     {
         OnFrameUpdate?.Invoke(session, frame);
     }
 }
Example #3
0
 public static void InvokeFrameUpdate()
 {
     if (OnFrameUpdate != null)
     {
         OnFrameUpdate.Invoke();
     }
 }
Example #4
0
        private void updateView()
        {
            long now = stopWatch.ElapsedMilliseconds;

            if (viewUpdateInterval < now - lastUpdate)
            {
                lastUpdate = now;
                OnFrameUpdate?.Invoke(this, new FrameEventArgs(player, asteroids, stopWatch.ElapsedMilliseconds / 1000L));
            }
        }
Example #5
0
        /// <summary>
        /// Called by the Unity engine during the game logic phase.
        /// This function is called once per frame. It is the main workhorse function for frame updates.
        /// </summary>
        public void Update()
        {
            OnFrameUpdate.Invoke();

            if (FlightGlobals.ActiveVessel == null || FlightGlobals.ActiveVessel.packed)
            {
                return;
            }
            var vs = Satellites[FlightGlobals.ActiveVessel];

            if (vs != null)
            {
                GetLocks();
                if (vs.HasLocalControl)
                {
                    ReleaseLocks();
                }
                else if (vs.FlightComputer != null && vs.FlightComputer.InputAllowed)
                {
#if !KSP131
                    var axisGroups = GetPressedAxisGroup();
                    for (int i = 0; i < axisGroups.Count(); i++)
                    {
                        if (axisGroups.ElementAt(i).Item2 != 0) //skip both - and + keys pressed at same time
                        {
                            vs.FlightComputer.Enqueue(AxisGroupCommand.WithGroup(axisGroups.ElementAt(i).Item1, axisGroups.ElementAt(i).Item2));
                        }
                    }
#endif

                    var actionGroups = GetActivatedActionGroup();
                    for (int i = 0; i < actionGroups.Count(); i++)
                    {
                        vs.FlightComputer.Enqueue(ActionGroupCommand.WithGroup(actionGroups.ElementAt(i)));
                    }
                }
            }
            else
            {
                ReleaseLocks();
            }
        }
Example #6
0
 public void SetFrameUpdateEvent(OnFrameUpdate handler)
 {
     this.frameUpdateEvent = handler;
 }
Example #7
0
 private void EngineWindow_UpdateFrame(object sender, FrameEventArgs e)
 {
     OnFrameUpdate?.Invoke(this, new Events.EventArgs.UpdateFrameEventArgs(e.Time));
     KeyboardInput.Update();
 }
 public void Update()
 {
     OnFrameUpdate.Invoke();
 }