/// <summary> /// Метод, привязывающий параметры второго осциллятора плагина к редактору. /// </summary> /// <param name="oscA"></param> /// <param name="envA"></param> private void BindOscB(OscillatorsManager oscB, EnvelopesManager envB) { var color = (SolidColorBrush)Resources["oscBKnobColor"]; // OscA BPitchSemi.AttachTo(oscB.PitchSemiManager, color, Converters.SemitonesToString); BPitchFine.AttachTo(oscB.PitchFineManager, color, Converters.CentsToString); BTimbre.AttachTo(oscB.WaveTableManager, color, Converters.WaveTableToString); // OscA envelope BAttack.AttachTo(envB.AttackTimeManager, color, Converters.EnvelopeTimeToString); BDecay.AttachTo(envB.DecayTimeManager, color, Converters.EnvelopeTimeToString); BSustain.AttachTo(envB.SustainLevelManager, color, Converters.PercentsToString); BRelease.AttachTo(envB.ReleaseTimeManager, color, Converters.EnvelopeTimeToString); BAmp.AttachTo(envB.EnvelopeAmplitudeManager, color, Converters.PercentsToString); BAttackCurve.AttachTo(envB.AttackCurveManager, color, Converters.EnvelopeCurveToString); BDecayReleaseCurve.AttachTo(envB.DecayReleaseCurveManager, color, Converters.EnvelopeCurveToString); }
private bool ProcessCommand(UnitCommand cmd) { if (!GetReady()) { return(false); } EUnitCommand eCmd = cmd._eCommandID; if (eCmd == EUnitCommand.UNITCMD_MOVE) { if (!_unit._isMobile) { return(false); } } else if (eCmd == EUnitCommand.UNITCMD_ATTACK) { if (!_unit._canAttack) { return(false); } } Behavior behavior = null; if (cmd._yQueue == QueueType.QUEUE_NONE) { // ClearBrainQueue(); } else { if (_behaviors.Count > 0) { behavior = _behaviors.Peek(); if (behavior.GetDefault()) { } else { bool popFront = true; if (eCmd == EUnitCommand.UNITCMD_TOOL) { GameObject obj = GameEntity.GetEntity(cmd._param); if (obj != null) { Tool tool = obj.GetComponent <Tool>(); if (tool != null) { popFront = !tool.NonInterrupting; } } } if (popFront) { behavior.EndBehavior(); _behaviors.Dequeue(); } } } } switch (eCmd) { case EUnitCommand.UNITCMD_MOVE: behavior = new BMove(this, _unit); break; case EUnitCommand.UNITCMD_ATTACK: behavior = new BAttack(this, _unit); break; case EUnitCommand.UNITCMD_TOOL: behavior = new BTool(this, _unit, cmd._param); break; default: Debug.LogWarning("Brain ProcessCommand: Unrecognized Unit Command"); break; } if (behavior != null) { behavior.SetDir(cmd._v3Dir); behavior.SetIssuedClientNumber(cmd._clientNumber); behavior.SetDefault(cmd._default); behavior.SetLevel(cmd._level); if (cmd._forced) { behavior.SetForced(true); behavior.SetForcedTime(Game._instance.GetGameTime() + cmd._forcedDuration); } if (cmd._restricted) { behavior.SetRestricted(true); } if (cmd._duration != uint.MaxValue) { behavior.SetEndTime(Game._instance.GetGameTime() + cmd._duration); } else { behavior.SetEndTime(uint.MaxValue); } if (cmd._yQueue == QueueType.QUEUE_FRONT) { if (_behaviors.Count > 0) { Behavior front = _behaviors.Peek(); if (front != null && front.GetRestricted()) { bool popFront = true; if (eCmd == EUnitCommand.UNITCMD_TOOL) { GameObject obj = GameEntity.GetEntity(cmd._param); if (obj != null) { Tool tool = obj.GetComponent <Tool>(); if (tool != null) { popFront = !tool.NonInterrupting; } } } if (popFront) { front.EndBehavior(); _behaviors.Dequeue(); } } } _behaviors.PushFront(behavior); } else if (cmd._yQueue == QueueType.QUEUE_FRONT_CLEAR_MOVES) { foreach (Behavior temp in _behaviors) { if (temp == null) { continue; } if (temp.GetBType() == Behavior.EBehaviorType.EBT_MOVE) { _behaviors.Erase(temp); continue; } } _behaviors.PushFront(behavior); } else { _behaviors.Enqueue(behavior); } return(true); } return(false); }