public Player(int n, int skin, LeftHand left, RightHand right) { number = n; this.left = left; this.right = right; this.skin = skin; }
// Swap the right hand between this player and other player public void swapRightHand(Player other) { RightHand tmp = this.right; this.right = other.right; other.right = tmp; }
public void RemoveAt(int index) { if (LeftHand != null) { if (index < LeftHand.Count) { LeftHand.RemoveAt(index); return; } else { index -= LeftHand.Count; } } if (index-- == 0) { Remove(Value); return; } if (RightHand != null && index < RightHand.Count) { RightHand.RemoveAt(index); return; } throw new ArgumentOutOfRangeException("index"); }
public Idle_State(Enemy_State_Pattern enemy_State_Pattern) { enemy = enemy_State_Pattern; anim = enemy.GetComponent <Animator>(); player = Singleton_Service.GetSingleton <Player>(); rightHand = Singleton_Service.GetSingleton <RightHand>(); }
private void Awake() { if (Instance && Instance != this) { Destroy(this); return; } Instance = this; Assert.IsNotNull(_leftHand); Assert.IsNotNull(_rightHand); LeftHand = _leftHand.GetComponent <OVRHand>(); LeftHandSkeleton = _leftHand.GetComponent <OVRSkeleton>(); LeftHandSkeletonRenderer = _leftHand.GetComponent <OVRSkeletonRenderer>(); LeftHandMesh = _leftHand.GetComponent <OVRMesh>(); LeftHandMeshRenderer = _leftHand.GetComponent <OVRMeshRenderer>(); RightHand = _rightHand.GetComponent <OVRHand>(); RightHandSkeleton = _rightHand.GetComponent <OVRSkeleton>(); RightHandSkeletonRenderer = _rightHand.GetComponent <OVRSkeletonRenderer>(); RightHandMesh = _rightHand.GetComponent <OVRMesh>(); RightHandMeshRenderer = _rightHand.GetComponent <OVRMeshRenderer>(); _leftMeshRenderer = LeftHand.GetComponent <SkinnedMeshRenderer>(); _rightMeshRenderer = RightHand.GetComponent <SkinnedMeshRenderer>(); StartCoroutine(FindSkeletonVisualGameObjects()); }
public void EquipItem(RightHand rightHand, LeftHand leftHand) { //right hand ActivateItem(rightHandParent, (int)rightHand); ActivateItem(leftHandParent, (int)leftHand); }
private void Update() { if (!Initialized) { return; } if (MetaCocoInterop.GetFrameHandsFlatbufferObject(ref _buffer, out _frame)) { _recievedFirstFrame = true; meta.types.HandData?incomingRight = null; meta.types.HandData?incomingLeft = null; for (int i = 0; i < _frame.HandsLength; i++) { switch (_frame.Hands(i).Value.HandType) { case meta.types.HandType.RIGHT: incomingRight = _frame.Hands(i); break; default: incomingLeft = _frame.Hands(i); break; } } RightHand.UpdateHand(incomingRight); LeftHand.UpdateHand(incomingLeft); RightHand.UpdateEvents(); LeftHand.UpdateEvents(); } }
public YAMLNode ExportYAML() { YAMLMappingNode node = new YAMLMappingNode(); node.AddSerializedVersion(SerializedVersion); node.Add("m_RootX", RootX.ExportYAML()); node.Add("m_Skeleton", Skeleton.ExportYAML()); node.Add("m_SkeletonPose", SkeletonPose.ExportYAML()); node.Add("m_LeftHand", LeftHand.ExportYAML()); node.Add("m_RightHand", RightHand.ExportYAML()); node.Add("m_Handles", Handles.ExportYAML()); node.Add("m_ColliderArray", ColliderArray.ExportYAML()); node.Add("m_HumanBoneIndex", HumanBoneIndex.ExportYAML(true)); node.Add("m_HumanBoneMass", HumanBoneMass.ExportYAML()); node.Add("m_ColliderIndex", ColliderIndex.ExportYAML(true)); node.Add("m_Scale", Scale); node.Add("m_ArmTwist", ArmTwist); node.Add("m_ForeArmTwist", ForeArmTwist); node.Add("m_UpperLegTwist", UpperLegTwist); node.Add("m_LegTwist", LegTwist); node.Add("m_ArmStretch", ArmStretch); node.Add("m_LegStretch", LegStretch); node.Add("m_FeetSpacing", FeetSpacing); node.Add("m_HasLeftHand", HasLeftHand); node.Add("m_HasRightHand", HasRightHand); node.Add("m_HasTDoF", HasTDoF); return(node); }
IEnumerator GetReady() { yield return(new WaitForSeconds(2f)); rightHand = Singleton_Service.GetSingleton <RightHand>(); isReady = true; }
public void Read(AssetStream stream) { RootX.Read(stream); Skeleton.Read(stream); SkeletonPose.Read(stream); LeftHand.Read(stream); RightHand.Read(stream); if (IsReadHandles(stream.Version)) { m_handles = stream.ReadArray <Handle>(); m_colliderArray = stream.ReadArray <Collider>(); } m_humanBoneIndex = stream.ReadInt32Array(); m_humanBoneMass = stream.ReadSingleArray(); if (IsReadColliderIndex(stream.Version)) { m_colliderIndex = stream.ReadInt32Array(); } Scale = stream.ReadSingle(); ArmTwist = stream.ReadSingle(); ForeArmTwist = stream.ReadSingle(); UpperLegTwist = stream.ReadSingle(); LegTwist = stream.ReadSingle(); ArmStretch = stream.ReadSingle(); LegStretch = stream.ReadSingle(); FeetSpacing = stream.ReadSingle(); HasLeftHand = stream.ReadBoolean(); HasRightHand = stream.ReadBoolean(); if (IsReadHasTDoF(stream.Version)) { HasTDoF = stream.ReadBoolean(); } stream.AlignStream(AlignType.Align4); }
public void InitializeOnceAtStartup(EgsDevice device) { RightHand.InitializeOnceAtStartup(device); LeftHand.InitializeOnceAtStartup(device); CursorImageSetInformationOptionalValue.SelectedItemChanged += (sender, e) => { RightHand.CurrentCursorImageSetIndex = CursorImageSetInformationOptionalValue.SelectedItem.Index; LeftHand.CurrentCursorImageSetIndex = CursorImageSetInformationOptionalValue.SelectedItem.Index; }; device.EgsGestureHidReport.RecognitionStateChanged += (sender, e) => { if (FirstFoundHand == null) { if (device.EgsGestureHidReport.Hands[(int)RightOrLeftKind.Right].IsTracking) { FirstFoundHand = _RightHand; } else if (device.EgsGestureHidReport.Hands[(int)RightOrLeftKind.Left].IsTracking) { FirstFoundHand = _LeftHand; } } else if (FirstFoundHand.IsTracking == false) { FirstFoundHand = null; } }; }
internal override ExValue Evaluate <TKey>(TagBatchInstance <TKey> instance) { ExValue left = LeftHand.Evaluate(instance); ExValue right = RightHand.Evaluate(instance); switch (Token.TokenType) { case TagTokenType.IsEqual: return(new ExValue(left.Equals(right))); case TagTokenType.IsNot: return(new ExValue(!left.Equals(right))); case TagTokenType.IsLte: return(new ExValue(left.CompareTo(right) <= 0)); case TagTokenType.IsLessThan: return(new ExValue(left.CompareTo(right) < 0)); case TagTokenType.IsGreaterThan: return(new ExValue(left.CompareTo(right) > 0)); case TagTokenType.IsGte: return(new ExValue(left.CompareTo(right) >= 0)); default: throw new InvalidOperationException(); } }
public YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion)); node.Add(RootXName, RootX.ExportYAML(container)); node.Add(SkeletonName, Skeleton.ExportYAML(container)); node.Add(SkeletonPoseName, SkeletonPose.ExportYAML(container)); node.Add(LeftHandName, LeftHand.ExportYAML(container)); node.Add(RightHandName, RightHand.ExportYAML(container)); node.Add(HandlesName, GetExportHandles(container.Version).ExportYAML(container)); node.Add(ColliderArrayName, GetExportColliderArray(container.Version).ExportYAML(container)); node.Add(HumanBoneIndexName, HumanBoneIndex.ExportYAML(true)); node.Add(HumanBoneMassName, HumanBoneMass.ExportYAML()); node.Add(ColliderIndexName, GetExportColliderIndex(container.Version).ExportYAML(true)); node.Add(ScaleName, Scale); node.Add(ArmTwistName, ArmTwist); node.Add(ForeArmTwistName, ForeArmTwist); node.Add(UpperLegTwistName, UpperLegTwist); node.Add(LegTwistName, LegTwist); node.Add(ArmStretchName, ArmStretch); node.Add(LegStretchName, LegStretch); node.Add(FeetSpacingName, FeetSpacing); node.Add(HasLeftHandName, HasLeftHand); node.Add(HasRightHandName, HasRightHand); node.Add(HasTDoFName, HasTDoF); return(node); }
void DummyJump() { bool take = false; RaycastHit hit; if (Physics.Raycast(LeftHand.position, LeftHand.forward, out hit, 20f)) { take = true; } if (Physics.Raycast(RightHand.position, RightHand.forward, out hit, 20f)) { take = true; } if (take) { rigidbody.velocity = new Vector3(0, 0, 0); rigidbody.AddForce(Vector3.up * Mathf.Min(1200f, JumpPower * 1200f)); if (JumpPower >= 0.8f) { LeftHand.GetComponentInChildren <ParticleSystem>().Play(); RightHand.GetComponentInChildren <ParticleSystem>().Play(); transform.DOMoveX(Random.Range(-13f, 13f), 6f).SetSpeedBased(); GameObject temp = Instantiate(Sparks) as GameObject; temp.transform.parent = transform; temp.transform.localPosition = new Vector3(0, 1.5f, -0.5f); } } JumpPower = 0; }
private void OnDestroy() { if (instance == this) { instance = null; } }
public void Unequip(WeaponSlot slot) { switch (slot) { case WeaponSlot.LEFT_HAND: if (LeftHand != null) { m_EquippableItems.Add(LeftHand); LeftHand.Active = false; LeftHand.ToggleItem(false); GameController.InvokeUnequippedWeapon(this, Owner, LeftHand); } LeftHand = null; break; case WeaponSlot.RIGHT_HAND: if (RightHand != null) { m_EquippableItems.Add(RightHand); RightHand.Active = false; RightHand.ToggleItem(false); GameController.InvokeUnequippedWeapon(this, Owner, RightHand); } RightHand = null; break; } }
// Use this for initialization void Start() { waitTime = 0.02f; scene = Singleton_Service.GetSingleton <SceneController>(); player = Singleton_Service.GetSingleton <Player>(); rightHand = Singleton_Service.GetSingleton <RightHand>(); leftHand = Singleton_Service.GetSingleton <LeftHand>(); music = Singleton_Service.GetSingleton <GameMusic>(); swordSource = rightHand.GetSword().GetComponent <AudioSource>(); swordAud = rightHand.GetSword().GetComponent <SwordAudio>(); shieldSource = leftHand.GetShield().GetComponent <AudioSource>(); shieldAud = leftHand.GetShield().GetComponent <ShieldAudio>(); playerHitSource = player.GetComponent <AudioSource>(); playerHitAud = player.GetComponent <PlayerHitAudio>(); playerAttack = player.GetAttack(); playerDefense = player.GetDefense(); anim = GetComponent <Animator>(); UpdateEnemyUI(); EnemyInit(); StartCoroutine("Updating"); currentState = idleState; currentState.StartState(); }
public YAMLNode ExportYAML(IExportContainer container) { #warning TODO: values acording to read version (current 2017.3.0f3) YAMLMappingNode node = new YAMLMappingNode(); node.AddSerializedVersion(GetSerializedVersion(container.Version)); node.Add("m_RootX", RootX.ExportYAML(container)); node.Add("m_Skeleton", Skeleton.ExportYAML(container)); node.Add("m_SkeletonPose", SkeletonPose.ExportYAML(container)); node.Add("m_LeftHand", LeftHand.ExportYAML(container)); node.Add("m_RightHand", RightHand.ExportYAML(container)); node.Add("m_Handles", GetExportHandles(container.Version).ExportYAML(container)); node.Add("m_ColliderArray", GetExportColliderArray(container.Version).ExportYAML(container)); node.Add("m_HumanBoneIndex", HumanBoneIndex.ExportYAML(true)); node.Add("m_HumanBoneMass", HumanBoneMass.ExportYAML()); node.Add("m_ColliderIndex", GetExportColliderIndex(container.Version).ExportYAML(true)); node.Add("m_Scale", Scale); node.Add("m_ArmTwist", ArmTwist); node.Add("m_ForeArmTwist", ForeArmTwist); node.Add("m_UpperLegTwist", UpperLegTwist); node.Add("m_LegTwist", LegTwist); node.Add("m_ArmStretch", ArmStretch); node.Add("m_LegStretch", LegStretch); node.Add("m_FeetSpacing", FeetSpacing); node.Add("m_HasLeftHand", HasLeftHand); node.Add("m_HasRightHand", HasRightHand); node.Add("m_HasTDoF", HasTDoF); return(node); }
public void Read(EndianStream stream) { RootX.Read(stream); Skeleton.Read(stream); SkeletonPose.Read(stream); LeftHand.Read(stream); RightHand.Read(stream); m_handles = stream.ReadArray(() => new Handle(m_assetsFile)); m_colliderArray = stream.ReadArray(() => new Collider(m_assetsFile)); m_humanBoneIndex = stream.ReadInt32Array(); m_humanBoneMass = stream.ReadSingleArray(); m_colliderIndex = stream.ReadInt32Array(); Scale = stream.ReadSingle(); ArmTwist = stream.ReadSingle(); ForeArmTwist = stream.ReadSingle(); UpperLegTwist = stream.ReadSingle(); LegTwist = stream.ReadSingle(); ArmStretch = stream.ReadSingle(); LegStretch = stream.ReadSingle(); FeetSpacing = stream.ReadSingle(); HasLeftHand = stream.ReadBoolean(); HasRightHand = stream.ReadBoolean(); HasTDoF = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); }
public static void Init() { leftHand = GameObject.Find("LeftHand"); RightHand = GameObject.Find("RightHand"); leftHandPi = GameObject.Find("LeftHandPi"); rightHandXian = GameObject.Find("RightHandXian"); twoHands = GameObject.Find("TwoHand"); bg1 = GameObject.Find("Background2_2"); bg2 = GameObject.Find("Background2_4"); leftHandAlpha = leftHand.GetComponent <Scene22AlphaControl>(); rightHandAlpha = RightHand.GetComponent <Scene22AlphaControl>(); leftHandPiAlpha = leftHandPi.GetComponent <Scene22AlphaControl>(); rightHandXianAlpha = rightHandXian.GetComponent <Scene22AlphaControl>(); dumplings5Alpha = GameObject.Find("Dumplings5").GetComponent <Scene22AlphaControl>(); dumplings6Alpha = GameObject.Find("Dumplings6").GetComponent <Scene22AlphaControl>(); bg1Alpha = bg1.GetComponent <Scene22AlphaControl>(); bg2Alpha = bg2.GetComponent <Scene22AlphaControl>(); twoHandsAlpha = twoHands.GetComponent <Scene22AlphaControl>(); leftHandPos = leftHand.transform.position; rightHandPos = RightHand.transform.position; leftHandPiPos = leftHandPi.transform.position; rightHandXianPos = rightHandXian.transform.position; }
//compares current scales and starts countdown if they match public void CheckAnswer() { //game is still ongoing if (!gameOver) { //get total masses of both scales int leftMass = LeftHand.GetTotalMass(); int rightMass = RightHand.GetTotalMass(); //save the totals as a string so we can keep track of when it changes string massString = leftMass.ToString() + rightMass.ToString(); //if the strings are the same, the calculation has already started, //so we dont need to start it again if (currentMassString != massString) { currentMassString = massString; //make sure they're the same and above 0 (so an empty scale doesnt count) if (leftMass == rightMass && leftMass + rightMass > 0) { coroutineId++; StartCoroutine(_CheckAnswer(currentMassString, coroutineId)); } } } }
// FixedUpdate stays in sync with the physics engine. private void FixedUpdate() { InputTracking.GetNodeStates(mNodeStates); foreach (XRNodeState nodeState in mNodeStates) { switch (nodeState.nodeType) { case XRNode.LeftHand: nodeState.TryGetPosition(out mLeftHandPos); nodeState.TryGetRotation(out mLeftHandRot); break; case XRNode.RightHand: nodeState.TryGetPosition(out mRightHandPos); nodeState.TryGetRotation(out mRightHandRot); break; } } LeftHand.MovePosition(mLeftHandPos); LeftHand.MoveRotation(mLeftHandRot.normalized); RightHand.MovePosition(mRightHandPos); RightHand.MoveRotation(mRightHandRot.normalized); }
private void UpdateAttackKeys() { if (Input.GetKey(KeyCode.F) && !isAttacking) { PlayAnim((int)Combo.thrown); foreach (var a in RightHand.GetComponentsInChildren <Renderer>()) { a.enabled = false; } var g = (Monkey)Instantiate(_Database.monkey, RightHand.position, RightHand.rotation); g.transform.parent = RightHand; Physics.IgnoreCollision(collider, g.collider); g.enabled = false; PlayAnim((int)Combo.thrown, delegate { g.enabled = true; g.transform.parent = null; g.transform.forward = mouseDir; g.vel = mouseDir * 20; foreach (var a in RightHand.GetComponentsInChildren <Renderer>()) { a.enabled = true; } }); } _Loader.Log(comboStartPos, comboEndPos); if (mouse && (!isAttacking || CurrentWeapon.weaponType == WeaponType.Bow)) { PlayAnim(mouse1 ? (int)CurrentWeapon.combosSpecial : CurrentWeapon.combos[(currentAttack % CurrentWeapon.combos.Length)], OnAttack); comboStartPos = pos; comboEndPos = mousePos; if (currentCombo == (int)Combo.hammer2) { StartCoroutine(AddUpdate(delegate { if (!infoSpecial.IsTag("idle")) { if ((comboStartPos - comboEndPos).magnitude > 2) { pos = Vector3.Lerp(comboStartPos, comboEndPos, -.2f + infoSpecial.normalizedTime * 2.5f); _Loader.Log(pos); } } return(isAttacking); })); } special = mouse1; } if (isAttacking && CurrentWeapon.ShootInterval > 0) { lastAttack += Time.deltaTime; if (lastAttack > CurrentWeapon.ShootInterval && CurrentWeapon.weaponType == WeaponType.Bow) { createBullet(); lastAttack = lastAttack % CurrentWeapon.ShootInterval; } } }
private void AddPositionDataToLineRendererList() { if (RightHand.TryGetFeatureValue(CommonUsages.triggerButton, out bool triggerButton) && triggerButton) { _lineRendererList.Last().positionCount += 1; _lineRendererList.Last().SetPosition(_lineRendererList.Last().positionCount - 1, GetRaycastHit.Hit.point + new Vector3(0, 0, 0.01f)); } }
void Awake() { if (instance == null) { instance = this; } //joint = GetComponent<FixedJoint>(); }
public void OnCatchArrow() { RightHand rightHand = character.GetComponentInChildren <RightHand>(); arrowInUse = Instantiate(arrowPrefab, rightHand.transform); arrowInUse.transform.localPosition = arrowOrientation.position; arrowInUse.transform.localRotation = arrowOrientation.rotation; }
public void OnAdditionalMouseClick() { if (_additionalCooldown <= 0f) { RightHand.AdditionalAction(this); _additionalCooldown = additionalMouseCooldown; } }
public bool IsSuccessfull() { if (RightHand.Equals(LeftHand)) { return(true); } return(ObeysExtensionTheorem()); }
public void OnMouseClick() { if (_mainCooldown <= 0f) { RightHand.MainAction(this); _mainCooldown = MainMouseCooldown; } }
public override void Update(GameTime gameTime) { LeftHand.Update(gameTime); RightHand.Update(gameTime); foreach (var tracker in trackedDevices) { tracker.Update(gameTime); } }