public void RecalcDotPos() { Vector3 pos = OriginPos; TempVal[] array = new TempVal[3]; TempValComparer temp = new TempValComparer(); array[0] = new TempVal(TempVal.Emotion.Jealousy, stats.Jealousy); array[1] = new TempVal(TempVal.Emotion.Pride, stats.Pride); array[2] = new TempVal(TempVal.Emotion.Ambition, stats.Ambition); Array.Sort(array, temp); for (int i = 0; i < 3; i++) { if (array[i].emotion == TempVal.Emotion.Jealousy) { pos += (JealousyPos.position - pos) * ((float)array[i].val / 20); StartCoroutine(LerpColorTransparency((float)array[i].val / 20, JealousyMat)); } else if (array[i].emotion == TempVal.Emotion.Pride) { pos += (PridePos.position - pos) * ((float)array[i].val / 20); StartCoroutine(LerpColorTransparency((float)array[i].val / 20, PrideMat)); } else if (array[i].emotion == TempVal.Emotion.Ambition) { pos += (AmbitionPos.position - pos) * ((float)array[i].val / 20); StartCoroutine(LerpColorTransparency((float)array[i].val / 20, AmbitionMat)); } } StartCoroutine(LerpDotPos(pos)); }
private void Form_Update_DoWork(object sender, DoWorkEventArgs e) { while (true) { switch (stateForm) { case WorkState.Idle: EnableControl(false); break; case WorkState.Update: EnableControl(true); if (state == State.New) { tick++; RED.Add(tick, Regs.Red_freq); BLUE.Add(tick, Regs.Blue_freq); GREEN.Add(tick, Regs.Green_freq); WHITE.Add(tick, Regs.White_freq); Drop.Add(tick, Regs.Drop_ADC); IR.Add(tick, Regs.Ir_ADC); myPane.CurveList.Clear(); myPane2.CurveList.Clear(); myPane3.CurveList.Clear(); LineItem Curve = myPane.AddCurve("RED", RED, Color.Red, SymbolType.None); LineItem Curve1 = myPane.AddCurve("BLUE", BLUE, Color.Blue, SymbolType.None); LineItem Curve2 = myPane.AddCurve("GREEN", GREEN, Color.Green, SymbolType.None); LineItem Curve3 = myPane.AddCurve("WHITE", WHITE, Color.Black, SymbolType.None); LineItem Curve4 = myPane2.AddCurve("DropADC", Drop, Color.Black, SymbolType.None); LineItem IR_line = myPane3.AddCurve("IR", IR, Color.Black, SymbolType.None); zedGraphControl1.AxisChange(); DropGraph.AxisChange(); IR_graph.AxisChange(); // Обновляем график zedGraphControl1.Invalidate(); DropGraph.Invalidate(); IR_graph.Invalidate(); DropVal.Invoke((MethodInvoker) delegate { DropVal.Text = Regs.Drop_ADC.ToString(); }); //DropVal.Text = Regs.Drop_ADC.ToString(); TempVal.Invoke((MethodInvoker) delegate { TempVal.Text = Regs.Temperature.ToString(); }); // TempVal.Text = Regs.Temperature.ToString(); scale_color(); state = State.Read; } break; } } //throw new NotImplementedException(); }