Exemplo n.º 1
0
 public void StartBump(Vector3 targVec, float dur)
 {
     targetVec   = targVec;
     startVec    = transform.position;
     distanceVec = new Vector3(targetVec.x - transform.position.x, transform.position.y, targetVec.z - transform.position.z);
     duration    = dur;
     elapsedTime = 0.0f;
     rigState    = RigState.Bump;
 }
Exemplo n.º 2
0
        public void UpdateState(RigState state)
        {
            var activeBus = FindByName(state.Name);

            if (activeBus != null)
            {
                activeBus.State = state;
            }
        }
Exemplo n.º 3
0
 public void StartFall(float targY, float dur)
 {
     targetY     = targY;
     start       = transform.position.y;
     distance    = targetY - transform.position.y;
     duration    = dur;
     elapsedTime = 0.0f;
     rigState    = RigState.Falling;
 }
Exemplo n.º 4
0
 void Start()
 {
     groundY  = transform.position.y;
     curY     = transform.position.y;
     rigState = RigState.Grounded;
     if (transform.parent != null)
     {
         originalParent = transform.parent.gameObject;
     }
 }
Exemplo n.º 5
0
 private void ParamsChangeEvent(int RigNumber, int Params)
 {
     if (RigNumber != 1 && RigNumber != 2)
     {
         return;
     }
     Console.WriteLine(String.Format("Param: {0}", Params));
     RigState rigState = GetRigState();
     var      json     = JsonConvert.SerializeObject(rigState);
 }
Exemplo n.º 6
0
 private void UpdateNewState(RigState state)
 {
     if (this.SerialNum == state.SerialNumDym)
     {
         return;
     }
     SerialNum = state.SerialNumDym;
     freqLong  = state.Freq;
     Frequency = Convert.ToDecimal(freqLong) / 1000000.0m;
     StateHasChanged();
 }
Exemplo n.º 7
0
        public async Task RadioStateChange(RigState state)
        {
            state.IncSerial();
            globalState = state;
            Log.Debug("146: State change {@state} ", state);
            ActiveService.UpdateState(state);
            await Clients.Group(SignalRGroups.Control).SendAsync(SignalRCommands.State, state);

            await Clients.Group(SignalRGroups.Radio).SendAsync(SignalRCommands.State, state);


            return;
        }
Exemplo n.º 8
0
        public async void SendRigState(RigState state)
        {
            if (state.IsDirty() == false)
            {
                return;
            }
            try
            {
                await connection.InvokeAsync("RadioStateChange", state);

                state.ClearDirty();
            }
            catch (Exception ex)
            {
                Log.Error("SigRConnect:110: Exception {@ex}", ex);
            }
        }
Exemplo n.º 9
0
        public void UpdateState(RigState state)
        {
            int index = BusStatusList.FindIndex(item => item.Name == state.Name);

            if (index != -1)
            {
                BusStatusList[index].State = state;
            }
            else
            {
                var bus = new BusStatusModel
                {
                    Name  = state.Name,
                    State = state
                };
                BusStatusList.Add(bus);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Does any initialization required before the address space can be used.
        /// </summary>
        /// <remarks>
        /// The externalReferences is an out parameter that allows the node manager to link to nodes
        /// in other node managers. For example, the 'Objects' node is managed by the CoreNodeManager and
        /// should have a reference to the root folder node(s) exposed by this node manager.
        /// </remarks>
        public override void CreateAddressSpace(IDictionary <NodeId, IList <IReference> > externalReferences)
        {
            lock (Lock)
            {
                LoadPredefinedNodes(SystemContext, externalReferences);

                // find the untyped Rig node that was created when the model was loaded.
                BaseObjectState passiveNode = (BaseObjectState)FindPredefinedNode(new NodeId(DsatsDemo.Objects.Rig, NamespaceIndex), typeof(BaseObjectState));

                // convert the untyped node to a typed node that can be manipulated within the server.
                m_rig = new RigState(null);
                m_rig.Create(SystemContext, passiveNode);

                m_rig.ChangePhase.OnCall = OnChangePhase;
                m_rig.ChangePhaseWithString.OnWriteValue      = OnChangePhaseByWrite;
                m_rig.ChangePhaseWithString.OnSimpleReadValue = OnReadPhase;

                // replaces the untyped predefined nodes with their strongly typed versions.
                AddPredefinedNode(SystemContext, m_rig);

                // need to refresh the root notifier now that the object has changed.
                AddRootNotifier(m_rig);

                // load the info for the datasources.
                LoadDataSource(SystemContext);

                // connect to server (only one active server supported at this time).
                if (m_remoteNodes != null)
                {
                    foreach (RemoteNode node in m_remoteNodes.Values)
                    {
                        m_source.Connect(node.ServerUrl, m_configuration.UseSecurity);
                        break;
                    }
                }

                // update the lock ids for the default phase.
                if (m_currentPhase != null)
                {
                    m_rig.CurrentPhase.Value = m_currentPhase;
                    ChangePhase(SystemContext, m_currentPhase);
                }
            }
        }
Exemplo n.º 11
0
    void Update()
    {
        //store the current position of the rig for changes
        Vector3 curPos = transform.position;

        switch (rigState)
        {
        case RigState.Climbing:
            //if climbing and still below threshold from target high
            if (curPos.y < targetY - threshold)
            {
                //keep climbing
                curY         = climbing(start, distance, elapsedTime, duration);
                elapsedTime += Time.deltaTime;
                curPos.y     = curY;
            }
            else
            {
                //stop climbing
                rigState = RigState.Floating;
                curY     = targetY;
                curPos.y = curY;
            }
            break;

        case RigState.Falling:
            //if falling and still above threshold distance from ground
            if (curPos.y > targetY + threshold)
            {
                //keep falling
                curY         = falling(start, distance, elapsedTime, duration);
                elapsedTime += Time.deltaTime;
                curPos.y     = curY;
            }
            else
            {
                //stop fall
                rigState = RigState.Grounded;
                curY     = targetY;
                curPos.y = curY;
            }
            break;

        //used for moving the user over time to a teleport location
        case RigState.Teleporting:
            float dist = Vector3.Distance(transform.position, targetVec);
            //if not cloe enough to teleport spot
            if (dist > threshold)
            {
                // keep moving
                curX         = teleporting(startVec.x, distanceVec.x, elapsedTime, duration);
                curY         = teleporting(startVec.y, distanceVec.y, elapsedTime, duration);
                curZ         = teleporting(startVec.z, distanceVec.z, elapsedTime, duration);
                elapsedTime += Time.deltaTime;
                curPos.x     = curX;
                curPos.y     = curY;
                curPos.z     = curZ;
            }
            else
            {
                //stop teleporting
                rigState = RigState.Grounded;
                curX     = targetVec.x;
                curY     = targetVec.y;
                curZ     = targetVec.z;
                curPos.x = curX;
                curPos.y = curY;
                curPos.z = curZ;
            }
            break;
        }

        if (transform.parent == null)
        {
            //if the position of the rig has changed
            if (transform.position != curPos)
            {
                transform.position = curPos;
            }
        }

        if (fadingIn)
        {
            fadingOut         = false;
            curAlpha          = fade(startAlpha, distAlpha, elapsedTimeAlpha, duration);
            elapsedTimeAlpha += Time.deltaTime;
            Color newColor = new Color(Panel_Fade.GetComponent <Image> ().color.r, Panel_Fade.GetComponent <Image> ().color.g, Panel_Fade.GetComponent <Image> ().color.b, curAlpha);
            if (newColor.a < 0.1f)
            {
                newColor.a = 0.0f;
                fadingIn   = false;
            }
            Panel_Fade.GetComponent <Image> ().color = newColor;
        }

        if (fadingOut)
        {
            fadingIn          = false;
            curAlpha          = fade(startAlpha, distAlpha, elapsedTimeAlpha, duration);
            elapsedTimeAlpha += Time.deltaTime;
            Color newColor = new Color(Panel_Fade.GetComponent <Image> ().color.r, Panel_Fade.GetComponent <Image> ().color.g, Panel_Fade.GetComponent <Image> ().color.b, curAlpha);
            if (newColor.a > 0.9f)
            {
                newColor.a = 1.0f;
                fadingOut  = false;
            }
            Panel_Fade.GetComponent <Image> ().color = newColor;
        }
    }
Exemplo n.º 12
0
 public void setRigState(RigState state)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public void SetRigState(RigState state)
 {
     setFreq(state.Freq);
     setFreqA(state.FreqA);
     setFreqB(state.FreqB);
 }
Exemplo n.º 14
0
 public void Put(int id, [FromBody] RigState value)
 {
     dummyRig.SetRigState(value);
 }
Exemplo n.º 15
0
 // PUT api/OmniRig/5
 public void Put(int id, [FromBody] RigState value)
 {
     oRig.SetRigState(id - 1, value);
 }
 public abstract void SetStateFromBus(RigState state);