protected void OnArmSynced(object sender, Arm arm, BraceletDirection direction, DateTime stamp) { if (this.ArmSyncedHasHandlers()) { _ArmSynced(sender, new ArmSyncedEventArgs(stamp, arm, direction)); } }
public bool Handle(MyoDataAnalyzer analyzer) { this._analyzer = analyzer; var rawData = analyzer.RawData; switch (_calibrating) { case Calibrating.FastAccel: _collectedValues.Add(rawData.Accel.Normal); break; case Calibrating.SlowAccel: _collectedValues.Add(rawData.Accel.Normal); break; case Calibrating.FastGyro: _collectedValues.Add(rawData.Gyro.Normal); break; case Calibrating.SlowGyro: _collectedValues.Add(rawData.Gyro.Normal); break; case Calibrating.Arm: _arm = Myo.GetCurrentArm(); break; default: //should never reach here break; } return(false); }
void assignSingleArm(Transform tr, Arm arm, Side side, ArmAspect armAspect) { GameObject armBase = getArmBase(arm); GameObject armObj = Instantiate(armBase); armObj.transform.SetParent(tr); Transform armTr = armObj.GetComponent <RectTransform>(); Transform armBaseTr = armBase.GetComponent <RectTransform>(); armTr.localScale = armBaseTr.localScale; armTr.localPosition = armBaseTr.localPosition; fixVerticalArmPosition(armTr, arm, side); applyArmAspect(armTr, armAspect, arm); // Left arms have default positions/rotations, so stop if (side == Side.LEFT || side == Side.UPPER_LEFT || side == Side.LOWER_LEFT) { return; } Model armModel = getModel(arm); fixRightArmPosition(armTr, armModel); }
public Questor(frmMain form1) { m_Parent = form1; _lastPulse = DateTime.MinValue; _random = new Random(); _salvage = new Salvage(); _defense = new Defense(); _combat = new Combat(); _traveler = new Traveler(); _unloadLoot = new UnloadLoot(); _agentInteraction = new AgentInteraction(); _arm = new Arm(); _missionController = new MissionController(); _drones = new Drones(); _panic = new Panic(); _storyline = new Storyline(); Settings.Instance.SettingsLoaded += SettingsLoaded; // State fixed on ExecuteMission State = QuestorState.Idle; _directEve = new DirectEve(); Cache.Instance.DirectEve = _directEve; Cache.Instance.StopTimeSpecified = Program.stopTimeSpecified; _directEve.OnFrame += OnFrame; }
/// <summary> /// Calculates how many cycles will be required to execute the reset instruction /// for a particular arm at the specified index of a fragment. /// </summary> private int CalculateResetTime(Program fragment, Arm arm, int index) { // Make a list of all instructions that will execute on this arm before this fragment var instructions = new List <Instruction>(); foreach (var priorFragment in m_fragments) { if (priorFragment == fragment) { break; } if (priorFragment.Instructions.TryGetValue(arm, out var priorInstructions)) { instructions.AddRange(priorInstructions); } } // Add all the instructions that will execute before the reset in the current fragment instructions.AddRange(fragment.Instructions[arm].GetRange(0, index)); // Skip everything up to the last reset, since it doesn't matter. Note if there are no // resets then LastIndexOf returns -1 and startIndex conveniently becomes 0. int startIndex = instructions.LastIndexOf(Instruction.Reset) + 1; return(CalculateResetTime(instructions.Skip(startIndex), arm.Extension)); }
public static string getArmDescription(Arm arm, ArmAspect armAspect) { string armAspectLetter = ""; switch (armAspect) { case ArmAspect.NORMAL: default: armAspectLetter = ""; break; case ArmAspect.SILVER: armAspectLetter = "_S"; break; case ArmAspect.GOLD: armAspectLetter = "_G"; break; } TextScript.Sentence armName = (TextScript.Sentence) System.Enum.Parse(typeof(TextScript.Sentence), "ARM" + (int)arm, true); TextScript.Sentence armDescription = (TextScript.Sentence) System.Enum.Parse(typeof(TextScript.Sentence), "ARM" + (int)arm + "_DESC" + armAspectLetter, true); return("<b>" + TextScript.get(armName) + "</b>\n\n" + TextScript.get(armDescription)); }
private async void OnRunScriptCommandAsync() { if (Arm == null) { return; } if (m_ScriptRunning) { m_ScriptRunning = false; return; } m_ScriptRunning = true; List <ArmCommand> commands = new List <ArmCommand>(Commands); do { foreach (var command in commands) { if (!m_ScriptRunning) { return; } try { await Arm.ExecuteCommandAsync(command); } catch (InvalidOperationException) { } } } while (RepeatScript); m_ScriptRunning = false; }
/// <summary> /// For the movement type were many small pushes occur /// </summary> /// <param name="arm"></param> /// <param name="direction"></param> public void AlternativeSwipe(Arm arm, Direction direction) { if (direction == Direction.Up) { lock (playerCloud.locker) { playerCloud.AddWindPuff((float)Math.PI / 2, arm); playerCloud.Speed += new Vector2(0, ALTERNATE_MOVE_SPEED); } } else if (direction == Direction.Down) { lock (playerCloud.locker) { playerCloud.AddWindPuff((float)-Math.PI / 2, arm); playerCloud.Speed += new Vector2(0, -ALTERNATE_MOVE_SPEED); } } else if (direction == Direction.Left) { lock (playerCloud.locker) { playerCloud.AddWindPuff(0, arm); playerCloud.Speed += new Vector2(ALTERNATE_MOVE_SPEED, 0); } } else { lock (playerCloud.locker) { playerCloud.AddWindPuff((float)Math.PI, arm); playerCloud.Speed += new Vector2(-ALTERNATE_MOVE_SPEED, 0); } } }
public VanBerloGenerator(ProgramWriter writer) : base(writer) { new Glyph(this, new Vector2(0, 1), Direction.SW, GlyphType.Duplication); m_wheelArm = new Arm(this, new Vector2(1, 1), Direction.E, MechanismType.VanBerlo); OutputArm = new Arm(this, new Vector2(3, 0), Direction.W, MechanismType.Arm1, extension: 3); }
private void Initialize() { // entities m_arm = new Arm(); m_finger = new Finger(); // processing & tracking m_processor = new TouchProcessor(m_arm, m_finger); m_optiTrack = new OptiTrack(); // models m_models = new Dictionary <ModelType, LinearModel>(); LinearModel horizontalModel = new LinearModel(Constants.Models.HorizontalRows, Constants.Models.HorizontalColumns, ModelDirection.Landscape); horizontalModel.Load(Constants.Models.HorizontalModelFileName); m_models.Add(ModelType.Horizontal, horizontalModel); LinearModel verticalModel = new LinearModel(Constants.Models.VerticalRows, Constants.Models.VerticalColumns, ModelDirection.Portrait); verticalModel.Load(Constants.Models.VerticalModelFileName); m_models.Add(ModelType.Vertical, verticalModel); LinearModel tracingModel = new LinearModel(Constants.Models.TracingRows, Constants.Models.TracingColumns, ModelDirection.Landscape); tracingModel.Load(Constants.Models.TracingModelFileName); m_models.Add(ModelType.Tracing, tracingModel); m_arm.AddModel(horizontalModel, ModelType.Horizontal, Constants.Colors.HorizontalGridModelColor); m_arm.AddModel(verticalModel, ModelType.Vertical, Constants.Colors.VerticalGridModelColor); m_arm.AddModel(tracingModel, ModelType.Tracing, Constants.Colors.TracingGridModelColor); }
public void assignArmsDebug(Transform tr, Arm arm1, Arm arm2, Arm arm3, Arm arm4) { assignSingleArm(tr, arm1, Side.UPPER_LEFT, ArmAspect.NORMAL); assignSingleArm(tr, arm2, Side.UPPER_RIGHT, ArmAspect.NORMAL); assignSingleArm(tr, arm3, Side.LOWER_LEFT, ArmAspect.NORMAL); assignSingleArm(tr, arm4, Side.LOWER_RIGHT, ArmAspect.NORMAL); }
Model getModel(Arm arm) { switch (arm) { case Arm.NORMAL: case Arm.POWER_GLOW: case Arm.BUZZSAW: case Arm.SHIELD: case Arm.FAN: case Arm.GRAPNEL: case Arm.SALVE: case Arm.FORBIDDEN_RELIC: case Arm.SIPHON: case Arm.BATTERY: case Arm.MIASMA: case Arm.FLOE: return(Model.STANDARD); case Arm.BLADE: case Arm.CARTILAGE: case Arm.ILLUSIONIST: return(Model.NON_SYMMETRICAL); case Arm.AEGIS: return(Model.THREE_SEGMENTS); case Arm.HOOK: return(Model.NO_GEAR); } Debug.Log("Model not associated, check getModel"); return(Model.STANDARD); }
public Hand makeHand(ref LEAP_HAND hand, Frame owningFrame) { Arm newArm = makeArm(ref hand.arm); Hand newHand = new Hand( (int)owningFrame.Id, (int)hand.id, hand.confidence, hand.grab_strength, hand.grab_angle, hand.pinch_strength, hand.pinch_distance, hand.palm.width, hand.type == eLeapHandType.eLeapHandType_Left, hand.visible_time, newArm, new List <Finger>(5), new Vector(hand.palm.position.x, hand.palm.position.y, hand.palm.position.z), new Vector(hand.palm.stabilized_position.x, hand.palm.stabilized_position.y, hand.palm.stabilized_position.z), new Vector(hand.palm.velocity.x, hand.palm.velocity.y, hand.palm.velocity.z), new Vector(hand.palm.normal.x, hand.palm.normal.y, hand.palm.normal.z), new Vector(hand.palm.direction.x, hand.palm.direction.y, hand.palm.direction.z), newArm.NextJoint //wrist position ); newHand.Fingers.Insert(0, makeFinger(owningFrame, ref hand, ref hand.thumb, Finger.FingerType.TYPE_THUMB)); newHand.Fingers.Insert(1, makeFinger(owningFrame, ref hand, ref hand.index, Finger.FingerType.TYPE_INDEX)); newHand.Fingers.Insert(2, makeFinger(owningFrame, ref hand, ref hand.middle, Finger.FingerType.TYPE_MIDDLE)); newHand.Fingers.Insert(3, makeFinger(owningFrame, ref hand, ref hand.ring, Finger.FingerType.TYPE_RING)); newHand.Fingers.Insert(4, makeFinger(owningFrame, ref hand, ref hand.pinky, Finger.FingerType.TYPE_PINKY)); return(newHand); }
public bool AutoVertical(Transform HandOTarget, Transform HandTarget, Arm oneArm) { Vector3 neckDelta = Vector3.zero; Vector3 ToTarget = HandOTarget.position - oneArm.upperArmStart.position; float Over = ToTarget.magnitude - oneArm.length; if (Over > 0) { neckDelta = ToTarget.normalized * Over; } float dY = neckStart.position.y + neckDelta.y - neck.position.y; if (hips.position.y + dY < hipsStart.position.y) { hips.Translate(0, dY, 0, Space.World); } else if (hips.position.y + dY > hipsStart.position.y) { hips.position = hipsStart.position; } oneArm.Calculate(HandTarget); return(hips.position.y < hipsStart.position.y); }
//Metodos Update (Adiciona ou subrai 1, se estado != valor) public Arm UpdateWrist(Arm arm, int value) { if (value < 1 || value > 7) { Console.WriteLine("!! Para o pulso, Valor = {0} é invalido. Tente um valor entre 1 e 7", value); return(arm); } if (arm.GetElbow() == 3) //só ocorre mudança se o cotovelo esteja "fortemente contraido" { if (arm.GetWrist() > value) { this.isUpdated = false; arm.SetWrist(arm.GetWrist() - 1); } else if (arm.GetWrist() < value) { this.isUpdated = false; arm.SetWrist(arm.GetWrist() + 1); } } else { Console.WriteLine("* Rotação do Pulso atualmente bloqueada, pois Cotovelo != 3"); } return(arm); }
public MainViewModel() { Current = this; Arm = new Arm(); COMHandler = new COMHandler(Arm); loadCommands(); }
public Questor() { _lastPulse = DateTime.MinValue; _random = new Random(); _salvage = new Salvage(); _defense = new Defense(); _combat = new Combat(); _traveler = new Traveler(); _unloadLoot = new UnloadLoot(); _agentInteraction = new AgentInteraction(); _arm = new Arm(); _missionController = new MissionController(); _drones = new Drones(); _panic = new Panic(); _storyline = new Storyline(); Settings.Instance.SettingsLoaded += SettingsLoaded; // State fixed on ExecuteMission State = QuestorState.Idle; _directEve = new DirectEve(); Cache.Instance.DirectEve = _directEve; _directEve.OnFrame += OnFrame; }
public void SetCurrentSpawnType(Arm arm) { CurrentSkillType = SkillType.NULL; MVC.GetView <UISkillBtn>().txtCurrentChoice.text = "当前选择:" + "无"; CurrentSpawnType = arm; }
/// <summary> /// For the movement type were many small pushes occur /// </summary> /// <param name="arm"></param> /// <param name="direction"></param> public void AlternativeSwipe(Arm arm, Direction direction) { if (direction == Direction.Up) { lock (player.locker) { player.AddWindPuff((float)Math.PI / 2, arm); player.Speed += new Vector2(0, ALTERNATE_MOVE_SPEED); } } else if (direction == Direction.Down) { lock (player.locker) { player.AddWindPuff((float)-Math.PI / 2, arm); player.Speed += new Vector2(0, -ALTERNATE_MOVE_SPEED); } } else if (direction == Direction.Left) { lock (player.locker) { player.AddWindPuff(0, arm); player.Speed += new Vector2(ALTERNATE_MOVE_SPEED, 0); } } else { lock (player.locker) { player.AddWindPuff((float)Math.PI, arm); player.Speed += new Vector2(-ALTERNATE_MOVE_SPEED, 0); } } }
private void OnClassifierEventUpdate(GattCharacteristic sender, GattValueChangedEventArgs args) { var eventBytes = args.CharacteristicValue.ToArray(); var eventType = eventBytes[0]; if (eventType == (byte)ClassifierEventType.Pose) { lock (_lock) { _myoHandPose = (Pose)BitConverter.ToInt16(eventBytes, 1); Debug.Log("Got hand pose: " + _myoHandPose); } } else if (eventType == (byte)ClassifierEventType.ArmSynced) { lock (_lock) { _myoArm = (Arm)eventBytes[1]; _myoXAxisDirection = (XDirection)eventBytes[2]; Debug.Log("Got X axis orientation: " + _myoXAxisDirection); } } else if (eventType == (byte)ClassifierEventType.Unlocked) { Debug.Log("Myo unlocked"); } }
/// <summary> /// Create a cloud storage account using an ARM storage management client /// </summary> /// <param name="storageClient">The client to use to get storage account details.</param> /// <param name="resourceGroupName">The resource group contining the storage account.</param> /// <param name="accountName">The name of the storage account.</param> /// <returns>A CloudStorageAccount that can be used by windows azure storage library to manipulate objects in the storage account.</returns> public static CloudStorageAccount GenerateCloudStorageAccount(Arm.IStorageManagementClient storageClient, string resourceGroupName, string accountName) { if (!TestMockSupport.RunningMocked) { var storageServiceResponse = storageClient.StorageAccounts.GetProperties(resourceGroupName, accountName); Uri blobEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Blob; Uri queueEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Queue; Uri tableEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Table; Uri fileEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.File; return new CloudStorageAccount( GenerateStorageCredentials(storageClient, resourceGroupName, accountName), blobEndpoint, queueEndpoint, tableEndpoint, fileEndpoint); } else { return new CloudStorageAccount( new StorageCredentials(accountName, Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))), new Uri(string.Format("https://{0}.blob.core.windows.net", accountName)), new Uri(string.Format("https://{0}.queue.core.windows.net", accountName)), new Uri(string.Format("https://{0}.table.core.windows.net", accountName)), new Uri(string.Format("https://{0}.file.core.windows.net", accountName))); } }
public Human(Windows.UI.Xaml.Controls.Panel canvas) { this.canvas = canvas; body = new Body(); head = new Head(body.Center, new Point(0, -90), this); leftArm = new Arm(body.Center, new Point(-30, -80), Util.FromPolar(50, Math.PI * 0.7), Util.FromPolar(50, Math.PI), this); rightArm = leftArm.Mirror(); leftLeg = new Arm(body.Center, new Point(0, 0), Util.FromPolar(60, Math.PI * 0.6), Util.FromPolar(50, Math.PI * 0.5), this); rightLeg = leftLeg.Mirror(); arms = new[] { leftArm, leftLeg, rightArm, rightLeg }; bodyShape = new Polygon() { Points = new Windows.UI.Xaml.Media.PointCollection() { leftArm.Root.GetAbsolutePosition(), rightArm.Root.GetAbsolutePosition(), leftLeg.Root.GetAbsolutePosition() } }; canvas.Children.Add(bodyShape); AddShapes(head.Shapes); head.UpdateShape(); foreach (var arm in arms) { AddShapes(arm.Shapes); } State = new StateManager(this); State.Push(); }
public Pendulum(Brush brush1, Brush brush2) { MaterialGroup material = new MaterialGroup(); material.Children.Add(new DiffuseMaterial(brush1)); material.Children.Add(new SpecularMaterial(Brushes.Gray, 100)); Cylinder ground = new Cylinder { Radius = 0.5, ScaleZ = 0.1, IsClosed = true }; ground.Position = new Point3D(0, 0, -ground.ScaleZ); ground.DiffuseMaterial.Brush = brush2; Children.Add(ground); Cylinder mast = new Cylinder(4) { ScaleX = 0.1, ScaleY = 0.2, ScaleZ = 2.2, IsClosed = true, Material = material }; Children.Add(mast); arm = new Arm(material) { Position = new Point3D(0.3, 0, 2) }; Children.Add(arm); }
public AnimationRecorder(Arm arm) { //set fields _arm = arm; _servoCount = _arm.Servos.Count; _animation = new Animation(); }
public Dictionary <string, int> GetSkillTotals(bool refresh = false) { if (_SkillTotals == null || refresh) { var totals = new Dictionary <string, int>(); var headTotals = Head?.GetSkillTotals(refresh) ?? new Dictionary <string, int>(); var torsoTotals = Torso?.GetSkillTotals(refresh) ?? new Dictionary <string, int>(); var armTotals = Arm?.GetSkillTotals(refresh) ?? new Dictionary <string, int>(); var waistTotals = Waist?.GetSkillTotals(refresh) ?? new Dictionary <string, int>(); var legTotals = Leg?.GetSkillTotals(refresh) ?? new Dictionary <string, int>(); var weaponTotals = _WeaponSlots?.GetSkillTotals() ?? new Dictionary <string, int>(); var charmTotals = Charm?.GetSkillTotals() ?? new Dictionary <string, int>(); TryAddRange(totals, headTotals); TryAddRange(totals, torsoTotals); TryAddRange(totals, armTotals); TryAddRange(totals, waistTotals); TryAddRange(totals, legTotals); TryAddRange(totals, weaponTotals); TryAddRange(totals, charmTotals); _SkillTotals = totals; } return(_SkillTotals); }
public bool GetArmFromDB(int id) { mscon.Open();// string msg = "select * from arm where arm_id=" + id; MySqlCommand mscmd = new MySqlCommand(msg, mscon); MySqlDataReader reader = mscmd.ExecuteReader(); int counter = 0; if (reader.Read()) { if (counter > 0) { Console.WriteLine("answer not unique"); arm = new Arm(); return(false); } Arm buffer = new Arm( new Vector(reader.GetFloat(1), reader.GetFloat(2), reader.GetFloat(3)), new Vector(reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6)), new Vector(reader.GetFloat(7), reader.GetFloat(8), reader.GetFloat(9)), new Vector(reader.GetFloat(10), reader.GetFloat(11), reader.GetFloat(12)), reader.GetFloat(13), reader.GetFloat(14), new LeapQuaternion(reader.GetFloat(15), reader.GetFloat(16), reader.GetFloat(17), reader.GetFloat(18)) ); counter++; arm = buffer; } mscon.Close();// return(true); }
public Dictionary <string, int> GetSlotTotals(bool refresh = false) { if (_SlotTotals == null || refresh) { var totals = new Dictionary <string, int>(); var headSlots = Head?.GetSlots(refresh) ?? new HashSet <Slots.Slot>(); var torsoSlots = Torso?.GetSlots(refresh) ?? new HashSet <Slots.Slot>(); var armSlots = Arm?.GetSlots(refresh) ?? new HashSet <Slots.Slot>(); var waistSlots = Waist?.GetSlots(refresh) ?? new HashSet <Slots.Slot>(); var legSlots = Leg?.GetSlots(refresh) ?? new HashSet <Slots.Slot>(); var weaponSlots = _WeaponSlots.ToHashSet(); var charmSlots = Charm?.GetSlots(refresh) ?? new HashSet <Slot>(); TryAddRange(totals, headSlots); TryAddRange(totals, torsoSlots); TryAddRange(totals, armSlots); TryAddRange(totals, waistSlots); TryAddRange(totals, legSlots); TryAddRange(totals, weaponSlots); TryAddRange(totals, charmSlots); _SlotTotals = totals; } return(_SlotTotals); }
private void MoveArms(ref Point p) { Arm arm = alg.GiveAnswer(ref p); vm.Elbow = arm.elbow; vm.Hand = arm.hand; }
public void TryPopulateSlot(Decoration decoration, SlotCombo slotCombo) { for (var i = 1; i <= slotCombo.Large + slotCombo.Medium + slotCombo.Small; i++) { if (Head?.PopulateSlot(decoration) == false) { if (Torso?.PopulateSlot(decoration) == false) { if (Waist?.PopulateSlot(decoration) == false) { if (Arm?.PopulateSlot(decoration) == false) { if (Leg?.PopulateSlot(decoration) == false) { if (_WeaponSlots?.PopulateSlot(decoration) == false) { if (Charm?.PopulateSlot(decoration) == false) { throw new System.Exception("Couldn't add decoration!"); } } } } } } } } }
public void Init(int id, Characters character, Transform UIPlayerTrans) { this.id = id; this.character = character; //设置信息 playerInfo = new PlayerInfo(id, this.character); //胳膊 arm = GetComponentInChildren <Arm>(); arm.Init(id, character); arm.OnEat += Arm_OnEat; //UI信息 this.playerUIInfo = UIPlayerTrans.GetChild(id).GetComponent <PlayerUIInfo>(); playerUIInfo.Init(character); //根据id设置触发按钮 switchKey = DicSwitchKey[id]; vomitKey = DicVomitKey[id]; //根据id设置箭头图标 arrowGo = new GameObject(this.character.ToString(), typeof(SpriteRenderer)); arrowGo.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("arrow/" + (id + 1).ToString()); arrowpool = transform.parent.Find("arrowpool"); arrowGo.transform.SetParent(arrowpool); //设置到箭头池 arrowGo.transform.localScale = Vector3.one * 0.16f; ChooseTargetIndex = id; ChooseTarget(); // 加载shit shitPrefab = Resources.Load <GameObject>("shit/shit"); //呕吐位置 vomitPos = transform.Find("vomitpos").position; playerInfo.OnVomit += PlayerInfo_OnVomit; playerInfo.OnBeVomit += PlayerInfo_OnBeVomit; }
void ISeamothArm.SetRotation(Arm arm, bool isDocked) { if (ThisSeamoth == null) { return; } if (isDocked) { SubRoot subRoot = ThisSeamoth.GetComponentInParent <SubRoot>(); if (subRoot.isCyclops) { if (arm == Arm.Right) { transform.localRotation = Quaternion.Euler(32, 336, 310); } else { transform.localRotation = Quaternion.Euler(32, 24, 50); } } else { transform.localRotation = Quaternion.Euler(0, 0, 0); } } else { transform.localRotation = Quaternion.Euler(0, 0, 0); } }
bool UseArm(Arm arm, Vector3 eulerAngleOffset) { if (arm.IsHoldingItem()) { arm.UseItem(); return(false); } RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, maxInteractionDistance)) { Transform objectHit = hit.transform; ItemComponent item = objectHit.GetComponent <ItemComponent>(); if (item) { arm.Hold(item, eulerAngleOffset); return(true); } } return(false); }
private void UPinit() { if (!_up) { _up = true; _l = new Kn5RenderableList(Kn5Node.CreateBaseNode("L"), null) { LocalMatrix = Matrix.Translation(_swRadius, 0, _swOffset), HighlightDummy = true }; _r = new Kn5RenderableList(Kn5Node.CreateBaseNode("R"), null) { LocalMatrix = Matrix.Translation(-_swRadius, 0, _swOffset), HighlightDummy = true }; _dbg0 = new Kn5RenderableList(Kn5Node.CreateBaseNode("debug"), null) { HighlightDummy = true }; _dbg1 = new Kn5RenderableList(Kn5Node.CreateBaseNode("debug"), null) { HighlightDummy = true }; //_steer.Add(_l); //_steer.Add(_r); _la = new Arm(_driver, true); _ra = new Arm(_driver, false); } }
/// <summary> /// Initializes a new instance of the <see cref="ArmRecognizedEventArgs"/> class. /// </summary> /// <param name="myo">The Myo that raised the event. Cannot be <c>null</c>.</param> /// <param name="timestamp">The timestamp of the event.</param> /// <param name="arm">The arm.</param> /// <param name="directionX">The direction x.</param> /// <exception cref="System.ArgumentNullException"> /// The exception that is thrown when <paramref name="myo"/> is null. /// </exception> public ArmRecognizedEventArgs(IMyo myo, DateTime timestamp, Arm arm, XDirection directionX) : base(myo, timestamp) { Contract.Requires<ArgumentNullException>(myo != null, "myo"); this.Arm = arm; this.XDirection = directionX; }
private IKSegment[] makeArm(Arm arm) { List<IKSegment> chain = new List<IKSegment>(); addToChain(ref chain, MiddleBack); addToChain(ref chain, UpperBack); addToChain(ref chain, arm.Shoulder); addToChain(ref chain, arm.UpperArm); addToChain(ref chain, arm.LowerArm); addToChain(ref chain, arm.Hand); return chain.ToArray(); }
public GenericCombatStoryline() { _neededAmmo = new List<Ammo>(); _agentInteraction = new AgentInteraction(); _arm = new Arm(); _traveler = new Traveler(); _combat = new Combat(); _drones = new Drones(); _salvage = new Salvage(); _missionController = new MissionController(); Settings.Instance.SettingsLoaded += ApplySettings; }
public GenericCombatStoryline() { _neededAmmo = new List<Ammo>(); _agentInteraction = new AgentInteraction(); _arm = new Arm(); _combat = new Combat(); _drones = new Drones(); _salvage = new Salvage(); _statistics = new Statistics(); _combatMissionCtrl = new CombatMissionCtrl(); Settings.Instance.SettingsLoaded += ApplySettings; }
public Human(Gender g, string n) { entName = n; gender = g; increaseIDMain (); ID = IDMain; LeftArm = new Arm(MIDLEFT,g); //left and right arms with gender weighting RightArm = new Arm(MIDRIGHT,g); LeftLeg = new Leg (MIDMID, g); RightLeg = new Leg (MIDMID, g); Skeleton.Add (LeftArm); Skeleton.Add (LeftLeg); Skeleton.Add (RightArm); Skeleton.Add (RightLeg); }
public void SwipeRight(Arm arm) { lock (playerCloud.locker) { playerCloud.AddWindPuff((float)Math.PI, arm); playerCloud.Speed += new Vector2(-MOVE_SPEED, 0); } }
private void Sync(Arm arm, XDirection xDirection) { if (arm != Arm.Unknown && xDirection != XDirection.Unknown) { OnArmSynced(new ArmSyncedEventArgs(this, GetTimestamp(), arm, xDirection)); } }
public ArmSyncedEventArgs(Myo myo, DateTime timestamp, Arm arm, XDirection xDirection) : base(myo, timestamp) { this.Arm = arm; this.XDirection = xDirection; }
public void MyoArm(string armName) { Debug.Log("received arm: " + armName); Arm arm; switch (armName) { case "LEFT": arm = Arm.Left; break; case "RIGHT": arm = Arm.Right; break; default: arm = Arm.Unknown; break; } _currentArm = arm; Sync(_currentArm, _xDirection); }
static void Main(string[] args) { bool exit = false; int op = 0; Console.Title = "Nehe Lessons"; do { do { WriteMenu (); int.TryParse (Console.ReadLine(), out op); } while (op == 0); try { switch (op) { case 1 : exit = true; break; case 2: // The 'using' idiom guarantees proper resource cleanup. // We request 30 UpdateFrame evnts per second, and unlimited // RenderFrame events (as fast as the computer can handle). using (Lesson02 lesson02 = new Lesson02 ()) { lesson02.Run (30.0); } break; case 3: using (Lesson03 lesson03 = new Lesson03 ()) { lesson03.Run (30.0); } break; case 4: using (Lesson04 lesson04 = new Lesson04 ()) { lesson04.Run (30.0); } break; case 5: using (Lesson05 lesson05 = new Lesson05 ()) { lesson05.Run (30.0); } break; case 6: using (Lesson06 lesson06 = new Lesson06 ()) { lesson06.Run (30.0); } break; case 7: using (Lesson07 lesson07 = new Lesson07 ()) { lesson07.Run (30.0); } break; case 8: using (Lesson08 lesson08 = new Lesson08 ()) { lesson08.Run (30.0); } break; case 9: using (Lesson09 lesson09 = new Lesson09 ()) { lesson09.Run (30.0); } break; case 10: using (Lesson10 lesson10 = new Lesson10 ()) { lesson10.Run (30.0); } break; case 11: using (Lesson11 lesson11 = new Lesson11 ()) { lesson11.Run (30.0); } break; case 12: using (Lesson12 lesson12 = new Lesson12 ()) { lesson12.Run (30.0); } break; case 13: using (Arm arm = new Arm ()) { arm.Run (30.0); } break; default: break; } } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); } } while (!exit); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine ("Bye!!"); }
static void OnRecognizedArm(object sender, RecognizedArmEventArgs e) { onArm = true; whichArm = e.Arm; }
private float CalculateArmAngle(JointType startJoint1, JointType endJoint1, Arm arm) { Joint joint1 = currentSkeleton.Joints[startJoint1]; Joint joint2 = currentSkeleton.Joints[endJoint1]; Vector3 vector1 = new Vector3(joint2.Position.X - joint1.Position.X, joint2.Position.Y - joint1.Position.Y, joint2.Position.Z - joint1.Position.Z); Vector3 vector2; if (arm == Arm.Left) vector2 = new Vector3(-1, 0, joint2.Position.Z - joint1.Position.Z); else vector2 = new Vector3(1, 0, joint2.Position.Z - joint1.Position.Z); return (float)Utils.CalculateAngle(vector1, vector2); }
public float BendAngle(Vector3 torsoTarget, Arm arm) { float baseAngle = Vector3.Angle (spineStartOrientation, torsoTarget - spine.position); float dSpine2Target = Vector3.Distance (spine.position, torsoTarget); float spineAngle = Mathf.Acos((dSpine2Target * dSpine2Target + length*length - arm.length * arm.length)/ (2 * dSpine2Target * length)) * Mathf.Rad2Deg; if (float.IsNaN(spineAngle)) spineAngle = 0; return Mathf.Min(baseAngle - spineAngle, maxHipAngle); }
public float AutoHorizontal(Transform HandOTarget, Transform HandTarget, Arm oneArm, Transform opositeUpperArm) { float bendAngle = 0; Vector3 torsoTarget = Vector3.zero; Vector3 dShoulderNeck = (opositeUpperArm.position - oneArm.upperArm.position) / 2; Vector3 ToTarget = HandOTarget.position - oneArm.upperArmStart.position; float Over = ToTarget.magnitude - oneArm.length; if (Over > 0) { torsoTarget = HandOTarget.position + dShoulderNeck; bendAngle = BendAngle(torsoTarget, oneArm); // arm should be left or right spine.rotation = spineStartRotation * Quaternion.AngleAxis(bendAngle, spineAxis); } else spine.rotation = spineStartRotation; oneArm.Calculate(HandTarget); return bendAngle; }
public void SwipeLeft(Arm arm) { lock (playerCloud.locker) { playerCloud.AddWindPuff(0, arm); playerCloud.Speed += new Vector2(MOVE_SPEED, 0); } }
public Symet BuildDNA() { Symet symet; Dictionary<int, Arm> arms = new Dictionary<int, Arm>(); Dictionary<int, Segment> segments; List<Vector2> bodyVertices = new List<Vector2>(); List<Vector2> segmentVertices; double parentFaceAngle; Vector2 vertice; // Build the body vertice = new Vector2(0, -1 * bodySize); bodyVertices.Add(vertice); for (int i = 1; i < Convert.ToInt32(bodyShape); i++) { vertice = new Vector2(0, -1 * bodySize); vertice = Vector2.Transform(vertice, Matrix.CreateRotationZ(Convert.ToSingle(((2 * Math.PI) / Convert.ToInt32(bodyShape) * i)))); bodyVertices.Add(vertice); } // Build the arms for (int i = 0; i < Convert.ToInt32(bodyShape); i++) { Arm tempArm; // Build the segments segments = new Dictionary<int, Segment>(); foreach (Chromosome chromosome in chromosomes.Values) { if (!chromosome.Active) continue; // Build the vertices and add segment segmentVertices = new List<Vector2>(); // Build the vertices. Ones attached to the main body are a special case if (chromosome.ParentID == 0) { parentFaceAngle = GetAngle(bodyVertices[i], bodyVertices[i < Convert.ToInt32(bodyShape) - 1 ? i + 1 : 0]); segmentVertices.Add(bodyVertices[i]); foreach (VectorP instruction in chromosome.Instructions) { // Get the cartesian coordinates of the instructions using the parent face as a base segmentVertices.Add(instruction.GetCartesian(parentFaceAngle) + bodyVertices[i]); } segmentVertices.Add(bodyVertices[i < Convert.ToInt32(bodyShape) - 1 ? i + 1 : 0]); } else { parentFaceAngle = GetAngle(segments[chromosome.ParentID].Vertices[chromosome.ParentFace - 1], segments[chromosome.ParentID].Vertices[chromosome.ParentFace]); segmentVertices.Add(segments[chromosome.ParentID].Vertices[chromosome.ParentFace - 1]); foreach (VectorP instruction in chromosome.Instructions) { // Get the cartesian coordinates of the instructions using the parent face as a base segmentVertices.Add(instruction.GetCartesian(parentFaceAngle) + segments[chromosome.ParentID].Vertices[chromosome.ParentFace - 1]); } segmentVertices.Add(segments[chromosome.ParentID].Vertices[chromosome.ParentFace]); } if (chromosome.ParentID != 0) segments[chromosome.ParentID].Faces[chromosome.ParentFace] = chromosome.ID; segments.Add(chromosome.ID, new Segment( segmentVertices, chromosome.ID, chromosome.ParentID, chromosome.ParentFace, chromosome.Type)); } tempArm = new Arm(segments); arms.Add(i, tempArm); } symet = new Symet(bodyVertices, arms, this); return symet; }
public Questor(frmMain form1) { m_Parent = form1; _lastPulse = DateTime.MinValue; _random = new Random(); //_debugmodule = new DebugModule(); //_scoop = new Scoop(); _salvage = new Salvage(); _defense = new Defense(); _localwatch = new LocalWatch(); _scanInteraction = new ScanInteraction(); _combat = new Combat(); _traveler = new Traveler(); _unloadLoot = new UnloadLoot(); _agentInteraction = new AgentInteraction(); _arm = new Arm(); _courier = new CourierMission(); _switch = new SwitchShip(); _missionController = new MissionController(); _drones = new Drones(); _panic = new Panic(); _storyline = new Storyline(); Settings.Instance.SettingsLoaded += SettingsLoaded; // State fixed on ExecuteMission State = QuestorState.Idle; _directEve = new DirectEve(); Cache.Instance.DirectEve = _directEve; Cache.Instance.StopTimeSpecified = Program.stopTimeSpecified; Cache.Instance.MaxRuntime = Program.maxRuntime; Cache.Instance.StopTime = Program._stopTime; _questorStarted = DateTime.Now; _directEve.OnFrame += OnFrame; }
// Update is called once per frame void Update() { frame = lp.CurrentFrame; if (frame.Hands.Count > 0) { HandList hands = frame.Hands; if (hands.Rightmost.IsRight) { Rfingers = right.fingers; righty = hands.Rightmost; rightArm = righty.Arm; } } if (right.isActiveAndEnabled) { if (Vector3.Distance (right.GetPalmPosition (), Rfingers [0].GetTipPosition ()) < trigger && Vector3.Distance (right.GetPalmPosition (), Rfingers [1].GetTipPosition ()) < trigger && Vector3.Distance (right.GetPalmPosition (), Rfingers [2].GetTipPosition ()) < trigger && Vector3.Distance (right.GetPalmPosition (), Rfingers [3].GetTipPosition ()) < trigger && Vector3.Distance (right.GetPalmPosition (), Rfingers [4].GetTipPosition ()) < trigger) { fist = true; // Debug.logger.Log ("fist true"); if (!shieldExists) { Instantiate (shield, Vector3.zero, Quaternion.identity); shield.SetActive (false); shieldExists = true; } if (!shieldUp && fist == true) { // Debug.logger.Log ("doing shield"); shield.SetActive(true); // Debug.Log (right.GetArmCenter()); shieldUp = true; } shield = GameObject.FindGameObjectWithTag ("Shield"); doShield (); } else { fist = false; if (shieldUp) { // Debug.logger.Log ("destroy about to be called"); // Destroy (GameObject.FindGameObjectWithTag ("Shield")); shield.SetActive(false); shieldUp = false; } } } else { shield.SetActive(false); shieldUp = false; } // for (int i = 0; i < Rfingers.Length; i++) // { // if (Vector3.Distance (right.GetPalmPosition (), Rfingers [i].GetTipPosition ()) < trigger) { // fist = true; // doShield (); // Debug.logger.Log ("fist true"); // } else { // fist = false; // Destroy (shield); // shieldUp = false; // } // } }
/// <summary> /// Adds windpuff at selected hand rotated after the direction parameter /// </summary> /// <param name="rotation">The rotation of the puff in radians</param> /// <param name="arm">Arm target for wind puff</param> public void AddWindPuff(float rotation, Arm arm) { Sprite hand; float offset; if (arm == Arm.Left) { hand = spriteDict[PlayerSprites.LeftHand]; offset = -hand.Size.X; } else { hand = spriteDict[PlayerSprites.RightHand]; offset = hand.Size.X; } Vector2 position = new Vector2(hand.Position.X + offset, hand.Position.Y); windPuffList.Add(new WindPuffMessage(rotation, position)); }
//________________________________________________________________________________________________ static void deliverDamage(Human attacker, Human defender, int targetPos) { Bone b = new Bone(); Arm a = new Arm (6, 1); bool severed = false; if (targetPos == 4) { a = defender.LeftArm; b = defender.LeftArm.ArmBones[Random.Range(1,defender.LeftArm.ArmBones.Count)]; } if (targetPos == 6) { a = defender.RightArm; b = defender.RightArm.ArmBones[Random.Range(1,defender.RightArm.ArmBones.Count)]; } if (checkSever (attacker.weapon, b)) { //remove arm if severed foreach(Bone c in a.ArmBones){ if (b.hierarchy < c.hierarchy && c.useHierarchy) { c.removeBone(c); } if (defender.weapon != null && a == defender.RightArm) { defender.weapon = null; } } severed = true; } try{ Debug.Log(a +" has been hit! Severed: " + severed); b.health -= attacker.weapon.avgDamage; b.checkBone (b); } catch {//bone wasnt set successfully probably } }
public void SwipeDown(Arm arm) { lock (player.locker) { player.AddWindPuff((float)-Math.PI / 2, arm); player.Speed += new Vector2(0, -MOVE_SPEED); } }
public ArmSyncedEventArgs(DateTime stamp, Arm arm, BraceletDirection direction) : base(stamp) { this.ArmUsed = arm; this.BraceletOrientation = direction; }
public void SwipeUp(Arm arm) { lock (playerCloud.locker) { playerCloud.AddWindPuff((float)Math.PI / 2, arm); playerCloud.Speed += new Vector2(0, MOVE_SPEED); } }
public bool AutoVertical(Transform HandOTarget, Transform HandTarget, Arm oneArm) { Vector3 neckDelta = Vector3.zero; Vector3 ToTarget = HandOTarget.position - oneArm.upperArmStart.position; float Over = ToTarget.magnitude - oneArm.length; if (Over > 0) neckDelta = ToTarget.normalized * Over; float dY = neckStart.position.y + neckDelta.y - neck.position.y; if (hips.position.y + dY < hipsStart.position.y) { hips.Translate(0, dY, 0, Space.World); } else if (hips.position.y + dY > hipsStart.position.y) { hips.position = hipsStart.position; } oneArm.Calculate(HandTarget); return (hips.position.y < hipsStart.position.y); }
protected void OnArmSynced (object sender, Arm arm, BraceletDirection direction, DateTime stamp) { if (this.ArmSyncedHasHandlers ()) { _ArmSynced (sender, new ArmSyncedEventArgs (stamp, arm, direction)); } }
public HandChecker(Arm arm, JointType joint) { this.arm = arm; this.joint = joint; }
private Dictionary<IKContactPoint.Fingers, IKSegment[]> makeHand(Arm arm) { var hand = new Dictionary<IKContactPoint.Fingers, IKSegment[]>(); hand.Add(IKContactPoint.Fingers.Index, makeFinger(arm.IndexFinger)); hand.Add(IKContactPoint.Fingers.Middle, makeFinger(arm.MiddleFinger)); hand.Add(IKContactPoint.Fingers.Ring, makeFinger(arm.RingFinger)); hand.Add(IKContactPoint.Fingers.Pinky, makeFinger(arm.PinkyFinger)); return hand; }