private float CalculateCritDamage(float damage) { const int CritBonusDamage = 2; const int RandomMin = 0; const int RandomMax = 100; float chance = Random.Range(RandomMin, RandomMax); if (chance < critChance) { damage *= CritBonusDamage; if (target is Player player) { LeftHand shield = (LeftHand)player .GetInventory() .GetEquipList() [(int)Inventory.EquipSlot.LeftHand]; if (shield != null) { damage = shield.ReduceCrit(damage); } } isCritting = true; } else { isCritting = false; } return(damage); }
public Player(int n, int skin, LeftHand left, RightHand right) { number = n; this.left = left; this.right = right; this.skin = skin; }
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 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); }
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()); }
// Swap the left hand between this player and other player public void swapLeftHand(Player other) { LeftHand tmp = this.left; this.left = other.left; other.left = tmp; }
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 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; } }
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); }
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; } }; }
//punch Left void PunchLeft() { APR_Parts[1].GetComponent <ConfigurableJoint>().targetRotation = new Quaternion(-0.15f, 0.15f, 0, 1); APR_Parts[5].GetComponent <ConfigurableJoint>().targetRotation = new Quaternion(0.25f, -0.7f, -0.3f, 1); APR_Parts[6].GetComponent <ConfigurableJoint>().targetRotation = new Quaternion(-1.5f, 0, 0, 1); StartCoroutine(DelayCoroutine()); IEnumerator DelayCoroutine() { yield return(new WaitForSeconds(0.5f)); APR_Parts[1].GetComponent <ConfigurableJoint>().targetRotation = new Quaternion(-0.15f, -0.15f, 0, 1); APR_Parts[5].GetComponent <ConfigurableJoint>().targetRotation = new Quaternion(-0.12f, 0.8f, 0, 1); APR_Parts[6].GetComponent <ConfigurableJoint>().targetRotation = new Quaternion(-0.15f, 0, 0, 1); //Left hand punch forward LeftHand.AddForce(APR_Parts[0].transform.forward * PunchForce, ForceMode.Impulse); APR_Parts[1].GetComponent <Rigidbody>().AddForce(APR_Parts[0].transform.forward * PunchForce, ForceMode.Impulse); yield return(new WaitForSeconds(0.3f)); APR_Parts[5].GetComponent <ConfigurableJoint>().targetRotation = UpperLeftArmTarget; Punching = false; } }
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(); } }
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(); } }
private void OnDestroy() { if (instance == this) { instance = null; } }
public void EquipItem(RightHand rightHand, LeftHand leftHand) { //right hand ActivateItem(rightHandParent, (int)rightHand); ActivateItem(leftHandParent, (int)leftHand); }
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); }
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); }
// 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(); }
private void Update() { if (IsInitialized()) { LeftHand.ShowSkeleton(VisualMode); RightHand.ShowSkeleton(VisualMode); } }
void Awake() { if (instance == null) { instance = this; } //joint = GetComponent<FixedJoint>(); }
public override void Update(GameTime gameTime) { LeftHand.Update(gameTime); RightHand.Update(gameTime); foreach (var tracker in trackedDevices) { tracker.Update(gameTime); } }
void createTrail() { LeftHand.AddComponent <TrailRenderer>(); trailrendLeft = LeftHand.GetComponent <TrailRenderer>(); trailrendLeft.time = 120.0f; RightHand.AddComponent <TrailRenderer>(); trailrendRight = RightHand.GetComponent <TrailRenderer>(); trailrendRight.time = 120.0f; }
public void UpdateHands(Pose pose, Transform parentTransform) { // Child the hands to the object we're working with, simplifies everything LeftHand.transform.parent = parentTransform; RightHand.transform.parent = parentTransform; // Pose 'em! LeftHand.ApplyPose(pose); RightHand.ApplyPose(pose); }
public String Information() { return(ToString() + "\n-------------------------" + "\nHelmet: " + (Helmet == null ? "none" : Helmet.ToString()) + "\nChestplate: " + (Chestplate == null ? "none" : Chestplate.ToString()) + "\nLeggings: " + (Leggins == null ? "none" : Leggins.ToString()) + "\nRightHand: " + (RightHand == null ? "none" : RightHand.ToString()) + "\nLeftHand: " + (LeftHand == null ? "none" : LeftHand.ToString())); }
void DoJumpPlayer() { 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 && !isRotate) { if (Global.ScrollSpeed < 20f) { float power = Global.ScrollSpeed + (Time.time - timer) * 10f; if (power > 20f) { power = 20f; // limit power } if (JumpPower >= 0.5f) { LeanTween.value(gameObject, Global.ScrollSpeed, power, 0.5f).setOnComplete(ZoomIn).setOnUpdate( (float value) => { Global.ScrollSpeed = value; } ).setEase(LeanTweenType.easeOutCubic); } } if (JumpPower >= 0.5f) { LeftHand.GetComponentInChildren <ParticleSystem>().Play(); RightHand.GetComponentInChildren <ParticleSystem>().Play(); } if (rigidbody.velocity.y < 0) { rigidbody.velocity = new Vector3(0, rigidbody.velocity.y * 0.3f, 0); } rigidbody.AddRelativeForce(Vector3.up * Mathf.Min(1000f, JumpPower * 1000f)); if (JumpPower >= 0.8f) { GameObject temp = Instantiate(Sparks) as GameObject; temp.transform.parent = transform; temp.transform.localPosition = new Vector3(0, 1.5f, -0.5f); } } JumpPower = 0; }
protected virtual void Start() { line = this.GetComponent <LineRenderer>(); initialGradient = SetInitialGradient(); line.colorGradient = initialGradient; leftHand = GameObject.FindObjectOfType <LeftHand>(); renderers = GameObject.FindObjectsOfType <EnableRenderer>(); obj = GameObject.FindObjectOfType <InteractableObject>(); }
public override void DefendLeftHand() { if (LeftHand != null) { LeftHand.Defend(); } else { Console.WriteLine("Блок левой рукой!"); } }
public override void AttackLeftHand() { if (LeftHand != null) { LeftHand.Attack(); } else { Console.WriteLine("Удар левой рукой!"); } }
private void LeftGripButtonDown() { LeftHand.TryGetFeatureValue(CommonUsages.gripButton, out bool tempState); if (tempState == true && tempState != lastButtonState_LeftGrip) { LeftGetGripButtonDown.Invoke(); } lastButtonState_LeftGrip = tempState; }
public void UpdateHands(Pose pose, Transform parentTransform) { LeftHand.transform.parent = parentTransform; RightHand.transform.parent = parentTransform; LeftHand.transform.localPosition = pose.leftHandInfo.attachPosition; RightHand.transform.localPosition = pose.rightHandInfo.attachPosition; LeftHand.ApplyPose(pose); RightHand.ApplyPose(pose); }