internal Endpoint(String name) : base(name) { Flags = DebugFlags._None; ActiveMode = ImportPipeline.ActiveMode.Lazy | ImportPipeline.ActiveMode.Global; CloseMode = ImportPipeline.CloseMode.Normal; }
public int GetIsSegmentActiveScore(ActiveMode mode, Time time, double? minPermanence = null, int? activationThreshold = null) { return Synapses.Count(synapse => synapse.IsConnected(minPermanence) && synapse.GetIsActive(mode, time)) - (activationThreshold ?? Network.Instance.Parameters.ActivationThreshold); }
public Endpoint (ImportEngine engine, XmlNode node, ImportPipeline.ActiveMode defActiveMode=0) : base(node) { Engine = engine; if (defActiveMode == 0) defActiveMode = ImportPipeline.ActiveMode.Lazy | ImportPipeline.ActiveMode.Global; if ((defActiveMode & (ImportPipeline.ActiveMode.Local | ImportPipeline.ActiveMode.Global)) != 0) defActiveMode |= ImportPipeline.ActiveMode.Global; Flags = node.ReadEnum<DebugFlags>("@flags", 0); CloseMode = node.ReadEnum("@closemode", CloseMode.Normal); ActiveMode = node.ReadEnum("@active", defActiveMode); switch (ActiveMode) { case 0: ActiveMode = defActiveMode; break; case ImportPipeline.ActiveMode.False: case ImportPipeline.ActiveMode.True: break; default: if ((ActiveMode & (ImportPipeline.ActiveMode.False | ImportPipeline.ActiveMode.True)) != 0) throw new BMNodeException (node, "ActiveMode true/false cannot be combined with other flags. ActiveMode={0}.", ActiveMode); if ((ActiveMode & (ImportPipeline.ActiveMode.Local | ImportPipeline.ActiveMode.Global)) != 0) ActiveMode |= defActiveMode & (ImportPipeline.ActiveMode.Local | ImportPipeline.ActiveMode.Global); break; } }
public SQLOutboundConfiguration() { InitializeComponent(); activeControl = new ActiveMode(); passiveControl = new PassiveMode(); Initialization(); }
public int GetIsSegmentActiveScore(ActiveMode mode, Time time, double?minPermanence = null, int?activationThreshold = null) { return(Synapses.Count(synapse => synapse.IsConnected(minPermanence) && synapse.GetIsActive(mode, time)) - (activationThreshold ?? Network.Instance.Parameters.ActivationThreshold)); }
private static void Init(SettingsBundle xml, MainForm mainForm) { // SETUP SKILLS if (xml.skills.def != null) SkillManager.InitSkills(xml.skills.def, xml.skills.special); SkillManager.CreateMissingSkills(); // SETUP ACTIONS if (xml.actions != null) ActiveMode.LoadSettings(xml.actions); ActiveMode.LoadDefaultSettings(); // INIT MAINFORM mainForm.Init(username: API.Users.AuthResult.user); // LOAD SCRIPTS ScriptManager.LoadScripts(); // OVERRIDE SCRIPTS if (xml.scripts != null) ScriptManager.OverrideScripts(xml.scripts); // INIT ACTIVE MODE ActiveMode.Init(); }
public override void Orbwalking_AfterAttack(AttackableUnit unit, AttackableUnit target) { if (!W.IsReady() || !W.IsActive()) { return; } if (target is Obj_AI_Hero && W.Cast()) { return; } if (ActiveMode.Equals(Orbwalking.OrbwalkingMode.LaneClear) && target is Obj_AI_Minion && MinionManager.GetMinions(AutoAttackRange + 165).Count >= MinMinionsW && W.Cast()) { return; } if (Menu.Item("TurretW").IsActive() && target is Obj_AI_Turret && W.Cast()) { return; } if (Menu.Item("InhibitorW").IsActive() && target is Obj_BarracksDampener && W.Cast()) { return; } if (Menu.Item("NexusW").IsActive() && target is Obj_HQ && W.Cast()) { } }
private void Update() { if (Input.GetKeyDown(inventoryOpenKey)) { showInventory = !showInventory; } if (showInventory) { InventoryOpen(); } else { mode = ActiveMode.inventory; InventoryClose(); } if (mode == ActiveMode.inventory) { if (inventory.lootPanel != null) { inventory.lootPanel.gameObject.SetActive(false); } } else if (mode == ActiveMode.loot) { if (inventory.lootPanel != null) { inventory.lootPanel.gameObject.SetActive(true); } } }
public override void Action() { Debug.Log("松鼠"); //松鼠 Enemy4 Check(); if (isAttack && mode == ActiveMode.StandBy) { mode = ActiveMode.Charge; } if (mode == ActiveMode.Charge) { t += Time.deltaTime; if (t >= 2) { move = player.transform.position - this.transform.position; mode = ActiveMode.Dash; t = 0; } } if (mode == ActiveMode.Dash) { Dash(); } }
static void OnHit(NPCInst attacker, NPCInst target, int damage) { if (!IsActive || ActiveMode.Phase < GamePhase.Fight) { return; } if (target.HP <= 0 && attacker.Client is ArenaClient attClient && target.Client is ArenaClient tarClient && attClient.GMTeamID >= 0 && tarClient.GMTeamID >= 0) { if (attClient.GMTeamID != tarClient.GMTeamID) { attClient.GMScore++; attClient.GMKills++; attClient.TDMTeam.Score++; attClient.SendPointsMessage(+1); tarClient.GMDeaths++; if (attClient.TDMTeam.Score >= ScoreLimit) { ActiveMode.FadeOut(); } } else // teamkill { attClient.GMScore--; attClient.TDMTeam.Score--; attClient.SendPointsMessage(-1); tarClient.GMDeaths++; } } }
private static void SetFormRefs(MainForm Ref) { HardwareListener.Init(Ref.Handle); UIActions.SetFormRef(Ref); ScriptManager.SetFormRef(Ref); SkillManager.SetFormRef(Ref); ActiveMode.SetFormRef(Ref); }
public static void ReadPhase(PacketReader stream) { if (!IsActive) { return; } ActiveMode.SetPhase((GamePhase)stream.ReadByte()); }
static GameMode() { GUCScripts.OnWorldEnter += () => { if (IsActive && ArenaClient.GMJoined && NPCClass.Hero == null) { ActiveMode.OpenJoinMenu(); MissionScreen.Show(ActiveMode.Scenario.MissionInfo); } }; }
public static void StartNextScenario() { if (IsActive) { ActiveMode.FadeOut(); } else { InitScenario(GameScenario.Get(NextScenarioIndex)); } }
/// <summary> /// getActiveSegment(c, i, t, state) /// For the given column c cell i, return a segment index such that segmentActive(s,t, state) is true. /// If multiple segments are active, sequence segments are given preference. /// Otherwise, segments with most activity are given preference. /// </summary> /// <param name="mode"></param> /// <param name="time"></param> /// <returns></returns> public Segment GetActiveSegment(ActiveMode mode, Time time) { var orderedSegments = Segments. Where(segment => segment.GetIsSegmentActive(mode, time)). OrderByDescending(segment => segment.GetIsSegmentActiveScore(mode, time)).ToArray(); var firstSequenceSegment = orderedSegments.FirstOrDefault(segment => segment.IsSequenceSegment); return firstSequenceSegment != null ? firstSequenceSegment : orderedSegments.FirstOrDefault(); }
/// <summary> /// getActiveSegment(c, i, t, state) /// For the given column c cell i, return a segment index such that segmentActive(s,t, state) is true. /// If multiple segments are active, sequence segments are given preference. /// Otherwise, segments with most activity are given preference. /// </summary> /// <param name="mode"></param> /// <param name="time"></param> /// <returns></returns> public Segment GetActiveSegment(ActiveMode mode, Time time) { var orderedSegments = Segments. Where(segment => segment.GetIsSegmentActive(mode, time)). OrderByDescending(segment => segment.GetIsSegmentActiveScore(mode, time)).ToArray(); var firstSequenceSegment = orderedSegments.FirstOrDefault(segment => segment.IsSequenceSegment); return(firstSequenceSegment != null ? firstSequenceSegment : orderedSegments.FirstOrDefault()); }
public static GameMode InitScenario(GameScenario scenario) { if (scenario == null) { return(null); } if (IsActive) { NextScenarioIndex = GameScenario.Scenarios.IndexOf(scenario); ActiveMode.FadeOut(); return(null); } Log.Logger.Log("Init game scenario " + scenario.Name); if (++NextScenarioIndex >= GameScenario.Count) { NextScenarioIndex = 0; } var mode = scenario.GetMode(); ActiveMode = mode; var world = new WorldInst(null) { Path = scenario.WorldPath }; world.Create(); SetWorldGlobals(world, scenario); mode.World = world; if (!string.IsNullOrWhiteSpace(scenario.SpawnWorld)) { var spawnWorld = new WorldInst(null) { Path = scenario.SpawnWorld }; spawnWorld.Create(); SetWorldGlobals(spawnWorld, scenario); mode.SpawnWorld = spawnWorld; } mode.Start(scenario); return(mode); }
public void Check() { Vector2 dis = player.transform.position - this.gameObject.transform.position; if (Distance(dis) <= distance) { isAttack = true; } else { isAttack = false; mode = ActiveMode.StandBy; } }
public Channel(ActiveMode frm, XCollection <SQLInboundChanel> channels) { InitializeComponent(); parentForm = frm; channelSet = channels; channel = new SQLInboundChanel(); type = "Add"; this.Text = "Add Channel"; criteriaItemList = new XCollection <SQLInQueryCriteriaItem>(); resultItemList = new XCollection <SQLInQueryResultItem>(); sqlStr = ""; GetChannelNameSet(channels); }
/// <summary> /// Copy Channel /// </summary> /// <param name="frm"></param> /// <param name="channels"></param> /// <param name="copyChannel"></param> public Channel(ActiveMode frm, XCollection <SQLInboundChanel> channels, SQLInboundChanel copyChannel) { InitializeComponent(); parentForm = frm; channelSet = channels; type = "Add"; channel = copyChannel; criteriaItemList = channel.Rule.QueryCriteria.MappingList; resultItemList = channel.Rule.QueryResult.MappingList; this.Text = "Add Channel"; GetChannelNameSet(channels); ShowChannel(channel); enumCmbbxOperationType.Enabled = false; }
public static void Start(string name) { var scenario = GameScenario.Get(name); if (scenario == null) { throw new Exception("GameScenario not found: " + name); } if (ActiveMode != null) { ActiveMode.End(); } ActiveMode = scenario.GetMode(); ActiveMode.Start(scenario); }
public Channel(ActiveMode frm, XCollection <SQLInboundChanel> channels, int index) { InitializeComponent(); parentForm = frm; channelSet = channels; type = "Edit"; this.Text = "Edit Channel"; channel = channelSet[index]; channelIndex = index; criteriaItemList = channelSet[index].Rule.QueryCriteria.MappingList; resultItemList = channelSet[index].Rule.QueryResult.MappingList; sqlStr = channelSet[index].Rule.QueryCriteria.SQLStatement; GetChannelNameSet(channels); ShowChannel(channel); enumCmbbxOperationType.Enabled = false; }
public bool CheckActivityStatusOfDevice(Slave slave, ActiveMode mode) { var startAddress = GetStartAddress(slave.DeviceNumber, 7); var register = _modbusSerial.ReadHoldingRegisters(slave.SlaveId, startAddress, 1).First(); switch (mode) { case ActiveMode.Equal: return(register == 128); case ActiveMode.EqualOrGreater: return(register >= 128); case ActiveMode.Greater: return(register > 128); default: return(register == 128); } }
public Channel(ActiveMode frm, XCollection <SQLOutboundChanel> channels) { InitializeComponent(); parentForm = frm; channelSet = channels; type = "Add"; this.Text = "Add Channel"; channel = new SQLOutboundChanel(); criteriaItemList = new XCollection <SQLOutQueryCriteriaItem>(); resultItemList = new XCollection <SQLOutQueryResultItem>(); GetChannelNameSet(channels); if (parentForm.DBconfig.ConnectionParameter.FileConnection) { this.enumCmbbxOperationType.SelectedIndex = 1; this.enumCmbbxOperationType.Enabled = false; this.txtModeName.Enabled = false; } }
public override void Action() { Debug.Log("种子草"); //种子草 Enemy5 Check(); if (isAttack && mode == ActiveMode.StandBy) { Debug.Log("开火"); //Attack mode = ActiveMode.Shoot; } if (mode == ActiveMode.Shoot) { t += Time.deltaTime; if (t >= 2) { Debug.Log("Shoot"); Shoot(); t = 0; } } }
public override void Action() { Debug.Log("蝴蝶"); //蝴蝶 Enemy6 Check(); if (mode == ActiveMode.StandBy) { t += Time.deltaTime; a += 4 * Time.deltaTime; this.transform.position += new Vector3(distance * Mathf.Sin(t) / 100f, distance * Mathf.Sin(a) / 100f, 0); if (isAttack) { mode = ActiveMode.Follow; } } if (mode == ActiveMode.Follow) { Vector2 vel = player.transform.position - this.transform.position; this.transform.position += new Vector3(vel.normalized.x, vel.normalized.y, 0) * 5 * Time.deltaTime; } }
public Channel(ActiveMode frm, XCollection <SQLOutboundChanel> channels, int index) { InitializeComponent(); parentForm = frm; channelSet = channels; type = "Edit"; this.Text = "Edit Channel"; channel = channelSet[index]; criteriaItemList = channelSet[index].Rule.QueryCriteria.MappingList; resultItemList = channelSet[index].Rule.QueryResult.MappingList; channelIndex = index; GetChannelNameSet(channels); ShowChannel(channel); enumCmbbxOperationType.Enabled = false; if (parentForm.DBconfig.ConnectionParameter.FileConnection) { this.enumCmbbxOperationType.SelectedIndex = 1; this.enumCmbbxOperationType.Enabled = false; this.txtModeName.Enabled = false; } }
private void saveCurrentPolygon(ActiveMode mode) { if (mode == ActiveMode._8Tooth) { _toothSet.ProblemTooth = _polygon; } else if (mode == ActiveMode._7Tooth) { _toothSet.NormalTooth = _polygon; } else if (mode == ActiveMode._Bone) { _toothSet.BoneEdge = _polygon; } }
public bool GetIsActive(ActiveMode mode, Time time) { return(m_isActive[(int)mode, (int)time]); }
public void SetIsActive(ActiveMode mode, Time time, bool value) { m_isActive[(int)mode, (int)time] = value; }
private void setMaxPloygonPointsCount(ActiveMode mode) { switch (mode) { case ActiveMode._7Tooth: _polygon.MaxPoligonPointsNumber = ToothSet.MaxNormalToothPointsCount; break; case ActiveMode._8Tooth: _polygon.MaxPoligonPointsNumber = ToothSet.MaxProblemToothPointsCount; break; case ActiveMode._Bone: _polygon.MaxPoligonPointsNumber = ToothSet.MaxBonePointsCount; break; } }
public ShowConnection(ActiveMode frm) { InitializeComponent(); this.configForm = frm; }
void OnMouseDown(SceneView sceneView, Event e) { duplicationOccured = false; moveCancelled = false; originalPosition = targetBrushTransform.position; fullDeltaAngle = 0; if (CameraPanInProgress) { currentMode = ActiveMode.None; } else { // Resize dotOffset3 = Vector3.zero; Vector2 mousePosition = e.mousePosition; // Reset which resize pair is being selected selectedResizeHandlePair = null; bool isAxisAlignedCamera = (EditorHelper.GetSceneViewCamera(sceneView) != EditorHelper.SceneViewCamera.Other); Vector3 cameraDirection = sceneView.camera.transform.forward; Bounds bounds = GetBounds(); bool handleClicked = false; for (int i = 0; i < resizeHandlePairs.Length; i++) { // Skip any that shouldn't be seen from this camera angle (axis aligned only) if (isAxisAlignedCamera && Mathf.Abs(Vector3.Dot(resizeHandlePairs[i].point1, cameraDirection)) > 0.001f) { continue; } Vector3 worldPosition = TransformPoint(bounds.center + resizeHandlePairs[i].point1.Multiply(bounds.extents)); if (EditorHelper.InClickZone(mousePosition, worldPosition)) { selectedResizeHandlePair = resizeHandlePairs[i]; selectedResizePointIndex = 0; handleClicked = true; e.Use(); } worldPosition = TransformPoint(bounds.center + resizeHandlePairs[i].point2.Multiply(bounds.extents)); if (EditorHelper.InClickZone(mousePosition, worldPosition)) { selectedResizeHandlePair = resizeHandlePairs[i]; selectedResizePointIndex = 1; handleClicked = true; e.Use(); } } if (handleClicked && selectedResizeHandlePair.HasValue) { Vector3 worldPosition1; Vector3 worldPosition2; if (selectedResizePointIndex == 1) { worldPosition1 = TransformPoint(bounds.center + selectedResizeHandlePair.Value.point1.Multiply(bounds.extents)); worldPosition2 = TransformPoint(bounds.center + selectedResizeHandlePair.Value.point2.Multiply(bounds.extents)); } else { worldPosition1 = TransformPoint(bounds.center + selectedResizeHandlePair.Value.point2.Multiply(bounds.extents)); worldPosition2 = TransformPoint(bounds.center + selectedResizeHandlePair.Value.point1.Multiply(bounds.extents)); } Vector2 screenPoint1 = Camera.current.WorldToScreenPoint(worldPosition1); Vector2 screenPoint2 = Camera.current.WorldToScreenPoint(worldPosition2); SabreMouse.SetCursorFromVector3(screenPoint2, screenPoint1); if(EnumHelper.IsFlagSet(e.modifiers, EventModifiers.Control)) { currentMode = ActiveMode.Rotate; Vector3 activeDirection; if (selectedResizePointIndex == 0) { activeDirection = selectedResizeHandlePair.Value.point1; } else { activeDirection = selectedResizeHandlePair.Value.point2; } initialRotationDirection = TransformDirection(activeDirection.Multiply(GetBounds().extents)); } else { currentMode = ActiveMode.Resize; } SceneView.RepaintAll(); } else { DetermineTranslationPlane(e); } } }
/// <summary> /// segmentActive(s, t, state) /// This routine returns true if the number of connected synapses on segment s that are active due /// to the given state at time t is greater than activationThreshold. /// The parameter state can be activeState, or learnState. /// </summary> /// <param name="mode"></param> /// <param name="time"></param> /// <returns></returns> public bool GetIsSegmentActive(ActiveMode mode, Time time) { return(GetIsSegmentActiveScore(mode, time) >= 0); }
public bool GetIsActive(ActiveMode mode, Time time) { return m_isActive[(int)mode, (int)time]; }
public void SetAsservissementMode(ActiveMode mode) { activeMode = mode; switch (activeMode) { case ActiveMode.Disabled: LabelPosX.Visibility = Visibility.Visible; LabelPosY.Visibility = Visibility.Visible; LabelAngleRadian.Visibility = Visibility.Visible; LabelConsigneX.Visibility = Visibility.Hidden; LabelConsigneTheta.Visibility = Visibility.Hidden; LabelErreurX.Visibility = Visibility.Hidden; LabelErreurTheta.Visibility = Visibility.Hidden; LabelCommandX.Visibility = Visibility.Hidden; LabelCommandTheta.Visibility = Visibility.Hidden; LabelConsigneM1.Visibility = Visibility.Hidden; LabelConsigneM2.Visibility = Visibility.Hidden; LabelErreurM1.Visibility = Visibility.Hidden; LabelErreurM2.Visibility = Visibility.Hidden; LabelCommandM1.Visibility = Visibility.Hidden; LabelCommandM2.Visibility = Visibility.Hidden; LabelCorrPX.Visibility = Visibility.Hidden; LabelCorrPTheta.Visibility = Visibility.Hidden; LabelCorrIX.Visibility = Visibility.Hidden; LabelCorrITheta.Visibility = Visibility.Hidden; LabelCorrDX.Visibility = Visibility.Hidden; LabelCorrDTheta.Visibility = Visibility.Hidden; LabelCorrPM1.Visibility = Visibility.Hidden; LabelCorrPM2.Visibility = Visibility.Hidden; LabelCorrIM1.Visibility = Visibility.Hidden; LabelCorrIM2.Visibility = Visibility.Hidden; LabelCorrDM1.Visibility = Visibility.Hidden; LabelCorrDM2.Visibility = Visibility.Hidden; LabelIRLeftEnd.Visibility = Visibility.Visible; LabelIRLeft.Visibility = Visibility.Visible; LabelIRCenter.Visibility = Visibility.Visible; LabelIRRigth.Visibility = Visibility.Visible; LabelIRRigthEnd.Visibility = Visibility.Visible; LabelTimestamp.Visibility = Visibility.Visible; LabelRobotState.Visibility = Visibility.Visible; break; case ActiveMode.Polar: LabelPosX.Visibility = Visibility.Visible; LabelPosY.Visibility = Visibility.Visible; LabelAngleRadian.Visibility = Visibility.Visible; LabelConsigneX.Visibility = Visibility.Visible; LabelConsigneTheta.Visibility = Visibility.Visible; LabelErreurX.Visibility = Visibility.Visible; LabelErreurTheta.Visibility = Visibility.Visible; LabelCommandX.Visibility = Visibility.Visible; LabelCommandTheta.Visibility = Visibility.Visible; LabelConsigneM1.Visibility = Visibility.Hidden; LabelConsigneM2.Visibility = Visibility.Hidden; LabelErreurM1.Visibility = Visibility.Hidden; LabelErreurM2.Visibility = Visibility.Hidden; LabelCommandM1.Visibility = Visibility.Hidden; LabelCommandM2.Visibility = Visibility.Hidden; LabelCorrPX.Visibility = Visibility.Visible; LabelCorrPTheta.Visibility = Visibility.Visible; LabelCorrIX.Visibility = Visibility.Visible; LabelCorrITheta.Visibility = Visibility.Visible; LabelCorrDX.Visibility = Visibility.Visible; LabelCorrDTheta.Visibility = Visibility.Visible; LabelCorrPM1.Visibility = Visibility.Hidden; LabelCorrPM2.Visibility = Visibility.Hidden; LabelCorrIM1.Visibility = Visibility.Hidden; LabelCorrIM2.Visibility = Visibility.Hidden; LabelCorrDM1.Visibility = Visibility.Hidden; LabelCorrDM2.Visibility = Visibility.Hidden; LabelIRLeftEnd.Visibility = Visibility.Visible; LabelIRLeft.Visibility = Visibility.Visible; LabelIRCenter.Visibility = Visibility.Visible; LabelIRRigth.Visibility = Visibility.Visible; LabelIRRigthEnd.Visibility = Visibility.Visible; LabelTimestamp.Visibility = Visibility.Visible; LabelRobotState.Visibility = Visibility.Visible; break; case ActiveMode.Independant: LabelPosX.Visibility = Visibility.Visible; LabelPosY.Visibility = Visibility.Visible; LabelAngleRadian.Visibility = Visibility.Visible; LabelConsigneX.Visibility = Visibility.Hidden; LabelConsigneTheta.Visibility = Visibility.Hidden; LabelErreurX.Visibility = Visibility.Hidden; LabelErreurTheta.Visibility = Visibility.Hidden; LabelCommandX.Visibility = Visibility.Hidden; LabelCommandTheta.Visibility = Visibility.Hidden; LabelConsigneM1.Visibility = Visibility.Visible; LabelConsigneM2.Visibility = Visibility.Visible; LabelErreurM1.Visibility = Visibility.Visible; LabelErreurM2.Visibility = Visibility.Visible; LabelCommandM1.Visibility = Visibility.Visible; LabelCommandM2.Visibility = Visibility.Visible; LabelCorrPX.Visibility = Visibility.Hidden; LabelCorrPTheta.Visibility = Visibility.Hidden; LabelCorrIX.Visibility = Visibility.Hidden; LabelCorrITheta.Visibility = Visibility.Hidden; LabelCorrDX.Visibility = Visibility.Hidden; LabelCorrDTheta.Visibility = Visibility.Hidden; LabelCorrPM1.Visibility = Visibility.Visible; LabelCorrPM2.Visibility = Visibility.Visible; LabelCorrIM1.Visibility = Visibility.Visible; LabelCorrIM2.Visibility = Visibility.Visible; LabelCorrDM1.Visibility = Visibility.Visible; LabelCorrDM2.Visibility = Visibility.Visible; LabelIRLeftEnd.Visibility = Visibility.Visible; LabelIRLeft.Visibility = Visibility.Visible; LabelIRCenter.Visibility = Visibility.Visible; LabelIRRigth.Visibility = Visibility.Visible; LabelIRRigthEnd.Visibility = Visibility.Visible; LabelTimestamp.Visibility = Visibility.Visible; LabelRobotState.Visibility = Visibility.Visible; break; } }
void OnMouseUp(SceneView sceneView, Event e) { duplicationOccured = false; moveCancelled = false; // Just let go of the mouse button, the resize operation has finished if (currentMode != ActiveMode.None) { selectedResizeHandlePair = null; currentMode = ActiveMode.None; if(csgModel.MouseIsDragging) { e.Use(); } SceneView.RepaintAll(); Undo.RecordObject(targetBrush.transform, "Rescaled Brush"); Undo.RecordObject(targetBrush, "Rescaled Brush"); } for (int i = 0; i < targetBrushes.Length; i++) { targetBrushes[i].ResetPivot(); } SabreMouse.ResetCursor(); }
void DetermineTranslationPlane(Event e) { Bounds bounds = GetBounds(); // Determine which face of the bounds the user has clicked Polygon[] translationBoxCollider = PolygonFactory.GenerateCube(); // Generates a unit cube // First of all rescale transform the unit cube so that it matches the bounds for (int i = 0; i < translationBoxCollider.Length; i++) { for (int j = 0; j < translationBoxCollider[i].Vertices.Length; j++) { Vector3 position = translationBoxCollider[i].Vertices[j].Position; position = position.Multiply(bounds.extents) + bounds.center; position = TransformPoint(position); // Also transform the positions if in local mode translationBoxCollider[i].Vertices[j].Position = position; } translationBoxCollider[i].CalculatePlane(); } // Construct a ray at the mouse position Vector2 currentPosition = e.mousePosition; Ray currentRay = Camera.current.ScreenPointToRay(EditorHelper.ConvertMousePosition(currentPosition)); // Raycast against the ray against the bounds polygons we just created float hitDistance; Polygon hitPolygon = GeometryHelper.RaycastPolygons(translationBoxCollider.ToList(), currentRay, out hitDistance, 0); if(hitPolygon != null) // We hit a polygon { currentMode = ActiveMode.Translate; // Use this polygon's plane as the active translation plane translationPlane = hitPolygon.Plane; } else // Didn't hit anything { currentMode = ActiveMode.None; } }
private void saveActivePlygon(ActiveMode mode) { switch (mode) { case ActiveMode._7Tooth: _toothSet.NormalTooth = _polygon; break; case ActiveMode._8Tooth: _toothSet.ProblemTooth = _polygon; break; case ActiveMode._Bone: _toothSet.BoneEdge = _polygon; break; } }
/// <summary> /// segmentActive(s, t, state) /// This routine returns true if the number of connected synapses on segment s that are active due /// to the given state at time t is greater than activationThreshold. /// The parameter state can be activeState, or learnState. /// </summary> /// <param name="mode"></param> /// <param name="time"></param> /// <returns></returns> public bool GetIsSegmentActive(ActiveMode mode, Time time) { return GetIsSegmentActiveScore(mode, time) >= 0; }
private void CheckBox_Unhecked(object sender, RoutedEventArgs e) { if (sender == CB_N7) this.prevoiusMode = ActiveMode._7Tooth; else if (sender == CB_N8) this.prevoiusMode = ActiveMode._8Tooth; else if (sender == CB_Bone) this.prevoiusMode = ActiveMode._Bone; if (CB_N7.IsChecked == false && CB_N8.IsChecked == false && CB_Bone.IsChecked == false) { ((CheckBox)sender).IsChecked = true; return; } }