public string GetAnimName(MotionType motion) { string name = mDefaultName; switch (motion) { case MotionType.Idle: name = "idle"; break; case MotionType.Die: name = "death"; break; case MotionType.Walk: name = "walk"; break; case MotionType.Run: name = "run"; break; case MotionType.Jump: name = "jump"; break; case MotionType.Attack: name = "attack"; break; } return name; }
internal BandDistanceReading(MotionType motion, double pace, double speed, long total) { CurrentMotion = motion; Pace = pace; Speed = speed; TotalDistance = total; }
public EMMotionProperties(MotionType motionType){ transform = new EMTransform(); this.motionType = motionType; sound = null; volume =1; autoClose = false; autoCloseDelayTime =0; isMove = false; moveDirection = MotionDirection.Top; moveEasing = new EMEasingParameter(); isRotate = false; rotateEasing= new EMEasingParameter(); isAlpha = false; alphaEasing = new EMEasingParameter(); isScale = false; scaleEasing = new EMEasingParameter(); if (motionType == MotionType.OneShot){ isInside = true; } else{ isInside = false; } }
protected void PlayAnimation(MotionType motion, float transitionDuration = 0.2f) { this.mAgent.blackboard.currentMotionType = motion; string name = this.mAgent.animationSet.GetAnimName(motion); mAnimator.CrossFade(name, transitionDuration, -1, 0.0f); mTransitionDuration = transitionDuration; mTransitionTimePassed = 0; }
// Creates a new rigid body and adds it to the simulation. private void AddBody(string name, Pose pose, Shape shape, MotionType motionType) { var rigidBody = new RigidBody(shape) { Name = name, Pose = pose, MotionType = motionType, }; simulation.RigidBodies.Add(rigidBody); }
private void AddRow(MotionType mt, float xS, float yS, float xE, float yE) { switch (mt) { case MotionType.LINE: stack.Rows.Add("LINE", xS, yS, xE, yE); break; default: Debug.WriteLine("MotionType didn't match"); break; } }
public LinearMotionAnimation(Point ptStart, Point ptEnd, int iDuration, MotionType mtType = MotionType.Linear, float fSpeed = 1) { m_ptStart = ptStart; m_ptEnd = ptEnd; m_iDuration = iDuration; m_mtMotionType = mtType; m_fSpeed = fSpeed; m_fRise = ptEnd.Y - ptStart.Y; m_fRun = ptEnd.X - ptStart.X; if (m_fRun == 0.0f) m_fRun = 1; m_fSlope = m_fRise / m_fRun; m_fYIntercept = ptStart.Y - (int)(m_fSlope * ptStart.X); }
/// <summary> /// Checks if the next position of the rover /// will be in the grid. /// </summary> /// <param name="location"></param> /// <param name="currentDirection"></param> /// <param name="motionType"></param> /// <returns></returns> private static bool CanMove(Point location, int currentDirection, MotionType motionType) { int sign = 1; if (motionType == MotionType.Backwards) { sign = -1; } int newX = location.X + sign * directions[currentDirection].X; int newY = location.Y + sign * directions[currentDirection].Y; if (0 <= newX && newX < gridSize && 0 <= newY && newY < gridSize) { return true; } else { return false; } }
void Sphere() { _motionType = MotionType.Sphere; var random = new Random(); var s = 0.0f; var c = 0.0f; var r = Math.PI * 2 / Roxik.Models.Count; var d = r * random.Next(1, 40); var d2 = random.Next(3, 8); foreach (var m in Roxik.Models) { MotionProperties p = m.GetComponent <MotionProperties>(); p.speed = 0; p.acceleration = (float)random.NextDouble() * 0.05f + 0.022f; p.animate = false; p.destination = new Vector3(); var d1 = (float)(Math.Cos(s) * d2); if ((float)random.NextDouble() > 0.06f) { p.destination.x = (float)Math.Cos(c) * d1; p.destination.y = (float)Math.Sin(s) * d2; p.destination.z = (float)Math.Sin(c) * d1; } else { p.destination.x = (float)random.NextDouble() * 7 - 7; p.destination.z = (float)random.NextDouble() * 7 - 7; p.destination.y = (float)random.NextDouble() * 7 - 7; } s += (float)r; c += (float)d; } }
private string getMotionPath(MotionType type) { if ((int)type < motionName.Length) { return("Live2D/" + NowMstID + "/" + NowMstID + motionName[(int)type]); } int num = 0; string result = string.Empty; switch (type) { case MotionType.Dislike1: num = Mst_DataManager.Instance.Mst_ship_resources[NowMstID].Motion1; result = ((num <= 1000) ? ("Live2D/" + num + "/" + num + motionName[0]) : ("Live2D/" + NowMstID + "/" + num + motionName[0])); break; case MotionType.Dislike2: num = Mst_DataManager.Instance.Mst_ship_resources[NowMstID].Motion2; result = ((num <= 1000) ? ("Live2D/" + num + "/" + num + motionName[0]) : ("Live2D/" + NowMstID + "/" + num + motionName[0])); break; case MotionType.Love1: num = Mst_DataManager.Instance.Mst_ship_resources[NowMstID].Motion3; result = ((num <= 1000) ? ("Live2D/" + num + "/" + num + motionName[0]) : ("Live2D/" + NowMstID + "/" + num + motionName[0])); break; case MotionType.Love2: num = Mst_DataManager.Instance.Mst_ship_resources[NowMstID].Motion4; result = ((num <= 1000) ? ("Live2D/" + num + "/" + num + motionName[0]) : ("Live2D/" + NowMstID + "/" + num + motionName[0])); break; } if (num == 0) { Debug.LogWarning("���[�V�����}�X�^�ɓo�^�����Ă��܂���"); return("Live2D/" + NowMstID + "/" + NowMstID + motionName[0]); } return(result); }
public void ChangeCurrentMotion() { MotionType motion = GetCurrentState(); //TODO: add check when this TryGetValue fails Motion.TryGetValue(motion, out CurrMotion); if (CurrMotion.DifferentMotionType(motion)) { CurrMotion.ResetCurrentFrame(); } switch (motion) { case MotionType.pickaxe: if (CurrMotion.LoopsPlayed >= 1) { MenuManager.SoundsPlayer.PlayIngameSound(MenuManager.SoundToPlay.Pickaxe); this.Interacting = false; CurrMotion.ResetCurrentFrame(); } break; } }
public void ExcuteMotion(MotionType mt) { switch (mt) { case MotionType.mt_none: break; case MotionType.mt_walk: anim.SetFloat("MoveSpeed", movement); break; case MotionType.mt_wave: anim.SetBool("Wave", true); break; case MotionType.mt_opendoor: anim.SetBool("opendoor", true); break; default: break; } }
void Tube() { _motionType = MotionType.Tube; var random = new Random(); var a = random.NextDouble() * 0.05f + 0.022f; var v = random.NextDouble() * 0.025f + 0.02f; var dx = -v * Roxik.Models.Count * 0.44f; var d = random.NextDouble() + 1.2f; for (var i = 0; i < Roxik.Models.Count; i++) { var m = Roxik.Models[i]; MotionProperties p = m.GetComponent <MotionProperties>(); p.speed = 0; p.acceleration = (float)a; p.animate = false; if (random.NextDouble() > 0.05f) { p.destination = new Vector3 { x = (float)(i * v + dx), y = (float)(random.NextDouble() * d - d * 0.5f), z = (float)(random.NextDouble() * d - d * 0.5f) }; } else { p.destination = new Vector3 { x = (float)(random.NextDouble() * 14 - 7), y = (float)(random.NextDouble() * 14 - 7), z = (float)(random.NextDouble() * 14 - 7) }; } } }
// Deserialize this instance from a Grasshopper reader object. public override bool Read(GH_IO.Serialization.GH_IReader reader) { if (reader.ItemExists("OutputCode")) { this.outputCode.Checked = reader.GetBoolean("OutputCode"); } if (reader.ItemExists("Manufacturer")) { this.Manufacturer = (Manufacturer)reader.GetInt32("Manufacturer"); } if (reader.ItemExists("MotionType")) { this.c_motionType = (MotionType)reader.GetInt32("MotionType"); } if (reader.ItemExists("RotAxis")) { this.extRotAxisCheck.Checked = reader.GetBoolean("RotAxis"); } if (reader.ItemExists("LinAxis")) { this.extLinAxisCheck.Checked = reader.GetBoolean("LinAxis"); } return(base.Read(reader)); }
public void Update() { if (this.isStop) { return; } if (this.NextMotionType == MotionType.None || MotionType == NextMotionType) { return; } try { this.Animator.SetFloat("MotionSpeed", this.MontionSpeed); this.Animator.SetTrigger(this.NextMotionType.ToString()); this.MontionSpeed = 1; this.MotionType = NextMotionType; } catch (Exception ex) { throw new Exception($"动作播放失败: {this.MotionType}", ex); } }
public override void Read(PackFileDeserializer des, BinaryReaderEx br) { base.Read(des, br); m_type = (MotionType)br.ReadByte(); m_deactivationIntegrateCounter = br.ReadByte(); m_deactivationNumInactiveFrames_0 = br.ReadUInt16(); m_deactivationNumInactiveFrames_1 = br.ReadUInt16(); br.ReadUInt64(); br.ReadUInt16(); m_motionState = new hkMotionState(); m_motionState.Read(des, br); m_inertiaAndMassInv = des.ReadVector4(br); m_linearVelocity = des.ReadVector4(br); m_angularVelocity = des.ReadVector4(br); m_deactivationRefPosition_0 = des.ReadVector4(br); m_deactivationRefPosition_1 = des.ReadVector4(br); m_deactivationRefOrientation_0 = br.ReadUInt32(); m_deactivationRefOrientation_1 = br.ReadUInt32(); m_savedMotion = des.ReadClassPointer <hkpMaxSizeMotion>(br); m_savedQualityTypeIndex = br.ReadUInt16(); m_gravityFactor = br.ReadInt16(); br.ReadUInt64(); br.ReadUInt32(); }
public void CubeType() { Type = MotionType.Cube; }
public void AddMotionToList(MotionType motionType) { //lst_MotionQueue.Add(motionType); }
public ActionMotionMode(MotionType motionType) : base() { this.motionType = motionType; }
public DefaultRigidBody(RigidBodyDescriptor descriptor) { _motionType = descriptor.MotionType; }
public void End() { quat = new Vector4D(); type = MotionType.None; }
public void Click(Vector2D pt, MotionType type) { this.startPt = pt; this.startVec = MapToSphere(pt); this.type = type; }
public PhysicsComponent(Mesh mesh, PhysicsType physics, MotionType motion) : base(mesh) { Physics = physics; Type = ComponentType.Physics; Motion = motion; }
/// <summary> /// Returns the new location of the rover /// based on its previous location, direction and motion type (forward or backwards). /// </summary> /// <param name="location"></param> /// <param name="currentDirection"></param> /// <param name="motionType"></param> /// <returns></returns> private static Point Move(Point location, int currentDirection, MotionType motionType) { int sign = 1; if (motionType == MotionType.Backwards) { sign = -1; } Point newLocation = new Point( location.X + sign * directions[currentDirection].X, location.Y + sign * directions[currentDirection].Y); return newLocation; }
/*--------------------------------------------------------------------------------------------*/ public void ToggleMotion(MotionType pType, bool pIsEnabled) { vMotionMap[pType].Enable(pIsEnabled); }
protected override void SolveInstance(IGH_DataAccess DA) { List <GH_ObjectWrapper> toolpath = new List <GH_ObjectWrapper>(); bool begin = false; bool reset = false; double position = 0.000; bool hasToolpath = true; if (!DA.GetDataList(0, toolpath)) { hasToolpath = false; return; } if (!DA.GetData(1, ref begin)) { return; } if (!DA.GetData(2, ref reset)) { return; } if (timeline) { if (!DA.GetData("Timeline", ref position)) { return; } } int index = 0; double programLength = toolpath.Count - 1; string mode = "Auto | "; if (begin && hasToolpath) // Add condition !timeline to ensure that the program can only be simulated using the slider. { if (reset) { n = 0; } // Reset the simulation to the first target. else if (n < programLength) { // Step through the program. n++; index = n; ExpireSolution(true); } else { if (toolpath.Count != 0) { index = toolpath.Count - 1; } else { index = 0; } } } else // Use the timeline slider to define the previewed program position. { mode = "Manual | "; double remappedIndex = Util.Remap(position, 0.0, 1.0, 0.0, programLength); int roundedIndex = Convert.ToInt32(remappedIndex); index = roundedIndex; } this.Message = mode + "Index: " + (index).ToString(); // Retrieve the current target from the program. GH_ObjectWrapper currTarg = toolpath[index]; Target targ = Target.Default; MotionType mType = MotionType.Linear; Type cType = currTarg.Value.GetType(); string command = String.Empty; double speed = 0; List <double> externals = new List <double>(); double linExt = 0; double rotExt = 0; if (cType.Name == "GH_String") { string cmd = currTarg.Value.ToString(); log.Add("Command."); // If we don't have a target, keep the robot at the last known position. if (cTarg != Target.Default) { DA.SetData(0, cTarg); } DA.SetData(1, cmd); } else { targ = currTarg.Value as Target; // Cast back to target type cTarg = targ; // Updated last target. DA.SetData(0, targ); // Output current target if (showSpeed) { // Current translational speed speed = targ.Speed.TranslationSpeed; DA.SetData("Speed", speed); } if (showExternal) { // External rotary axis rotExt = targ.ExtRot; if (rotExt != Util.ExAxisTol) { externals.Add(rotExt); } // External linear axis linExt = targ.ExtLin; if (linExt != Util.ExAxisTol) { externals.Add(linExt); } DA.SetDataList("External", externals); } } }
public void End() { quat = new Vector4D(); type = MotionType.None; }
public override string GetRotateAnim(MotionType motionType, RotationType rotationType) { return(null); }
public void LoopType() { Type = MotionType.Loop; }
public RigidBodyDescriptor(MotionType motionType, Matrix4x4 pose, object userData = null) : this() { MotionType = motionType; Pose = pose; UserData = userData; }
// Creates a new rigid body and adds it to the simulation. private static RigidBody AddBody(Simulation simulation, string name, Pose pose, Shape shape, MotionType motionType) { var rigidBody = new RigidBody(shape) { Name = name, Pose = pose, MotionType = motionType, }; simulation.RigidBodies.Add(rigidBody); return rigidBody; }
// Creates a new rigid body and adds it to the simulation. private static RigidBody AddBody(Simulation simulation, string name, Pose pose, Shape shape, MotionType motionType) { var rigidBody = new RigidBody(shape) { Name = name, Pose = pose, MotionType = motionType, }; simulation.RigidBodies.Add(rigidBody); return(rigidBody); }
/*--------------------------------------------------------------------------------------------*/ public void ToggleMotion(MotionType pType, bool pIsEnabled) { vMotionMap[pType].Enable(pIsEnabled); }
public void Click(Vector2D pt, MotionType type) { this.startPt = pt; this.startVec = MapToSphere(pt); this.type = type; }
public DetectedMotion(int confidence, MotionType type) { this.Confidence = confidence; this.Type = type; }
public TransformInfo(Guid rigidBodyId, RigidBodyTransform transform, MotionType motionType) { RigidBodyId = rigidBodyId; Transform = transform; MotionType = motionType; }
public abstract string GetRotateAnim(MotionType motionType, RotationType rotationType);
public static DiscordEmbed BuildMotionEmbed(string username, string avatarUrl, MotionType motionType, string motionText = null) { string motionTitle = motionType switch { MotionType.OPEN => "A motion to open has been raised", MotionType.MOD => "A motion for a moderated caucus has been raised", MotionType.UNMOD => "A motion for an unmoderated caucus has been raised", MotionType.RESOLUTION => "A motion for a resolution has been raised", MotionType.LUNCH => "A motion for lunch has been raised", MotionType.ADJOURN => "A motion to adjourn the session has been raised", _ => throw new ArgumentException("Incorrect motion type specified") }; var motionEmbedBuilder = new DiscordEmbedBuilder() .WithAuthor(username, null, avatarUrl) .WithTitle(motionTitle) .WithTimestamp(DateTime.UtcNow) .WithColor(DiscordColor.CornflowerBlue); if (motionText != null) { motionEmbedBuilder.WithDescription(motionText); } var motionEmbed = motionEmbedBuilder.Build(); return(motionEmbed); } }
public IEnumerator SetSpikeFalse() { yield return new WaitForSeconds(0.3f); if(player.transform.localPosition.y > -75f) pMotion = MotionType.JUMP; else { pMotion = MotionType.WALK; playerSprite.Play("Idle"); can_swipe = true; } pSpike = SpikeType.NONE; motion_change = false; motion_change_spike = false; }
public abstract string GetMoveAnim(MotionType motion, MoveType move, WeaponType weapon, WeaponState weaponState);
public IEnumerator WakeUp() { yield return new WaitForSeconds(0.2f); if(is_reversed) { if(is_right_user) { player.transform.FindChild("playerSprite").localRotation = Quaternion.Euler(new Vector3(0,180,0)); } else { player.transform.FindChild("playerSprite").localRotation = Quaternion.Euler(new Vector3(0,0,0)); } } pMotion = MotionType.WALK; playerSprite.Play("Idle"); vel_y = 0; vel_x = 0; motion_change = false; can_swipe = true; is_reversed = false; }
public override bool Read(GH_IReader reader) { CurrentMotionMode = (MotionType)reader.GetInt32("MotionMode"); return(base.Read(reader)); }
/// <summary> /// Apply Motion Action. /// </summary> /// <param name="action"></param> /// <returns></returns> public bool ApplyAction(ActionMotionMode action) { this.motionType = action.motionType; return(true); }
public static void LinkImages(PSB psb, FreeMountContext context, IList <string> resPaths, string baseDir = null, PsbLinkOrderBy order = PsbLinkOrderBy.Convention, bool isExternal = false) { if (isExternal) { MotionType.MotionResourceInstrument(psb); } var rawResList = psb.CollectResources <ImageMetadata>(); if (order == PsbLinkOrderBy.Order) { for (int i = 0; i < rawResList.Count; i++) { var resMd = rawResList[i]; var fullPath = Path.Combine(baseDir ?? "", resPaths[i]); resMd.Link(fullPath, context); } return; } var resList = rawResList.ToList(); if (order == PsbLinkOrderBy.Name) { if (psb.Platform == PsbSpec.krkr) { throw new InvalidOperationException( $"Can not link by file name for krkr PSB. Please consider using {PsbLinkOrderBy.Convention}"); } resList.Sort((md1, md2) => (int)(((ImageMetadata)md1).TextureIndex ?? 0) - (int)(((ImageMetadata)md2).TextureIndex ?? 0)); } for (var i = 0; i < resPaths.Count; i++) { var resPath = resPaths[i]; var resName = Path.GetFileNameWithoutExtension(resPath); //var resMd = uint.TryParse(resName, out uint rid) // ? resList.FirstOrDefault(r => r.Index == rid) // : resList.FirstOrDefault(r => // resName == $"{r.Part}{PsbResCollector.ResourceNameDelimiter}{r.Name}"); //Scan for Resource ImageMetadata resMd = null; if (order == PsbLinkOrderBy.Name) { if (resName == null) { continue; } if (resList.Count == 1 && resPaths.Count == 1) { //If there is only one resource and one texture, we won't care about file name. resMd = resList[0]; } else { var texIdx = ImageMetadata.GetTextureIndex(resName); if (texIdx == null) { Console.WriteLine($"[WARN]{resPath} is not used since the file name cannot be recognized."); continue; } if (resList.Count <= texIdx.Value) { Console.WriteLine($"[WARN]{resPath} is not used since the tex No. is too large."); continue; } resMd = resList[(int)texIdx.Value]; } } else //if (order == PsbLinkOrderBy.Convention) { resMd = resList.FirstOrDefault(r => resName == $"{r.Part}{Consts.ResourceNameDelimiter}{r.Name}"); if (resMd == null && uint.TryParse(resName, out uint rid)) { //This Link has no support for raw palette resMd = resList.FirstOrDefault(r => r.Index == rid); } if (resMd == null && psb.Type == PsbType.Pimg) { resMd = resList.FirstOrDefault(r => resName == Path.GetFileNameWithoutExtension(r.Name)); } } if (resMd == null) { Console.WriteLine($"[WARN]{resPath} is not used."); continue; } var fullPath = Path.Combine(baseDir ?? "", resPath.Replace('/', '\\')); resMd.Link(fullPath, context); } }
public bool IssueMotionRequest(MotionType motionType) => IssueApplyActionRequest(new ActionMotion(motionType));
private void PlayAnim(MotionType motion, WeaponState weaponState) { Owner.BlackBoard.motionType = motion; Owner.BlackBoard.weaponState = weaponState; CrossFade(Owner.AnimSet.GetMoveAnim(Owner.BlackBoard.motionType, MoveType.FORWARD, Owner.BlackBoard.weaponSelected, Owner.BlackBoard.weaponState), 0.2f); }
// Process the skeleton data void ProcessSkeleton() { List <uint> lostUsers = new List <uint>(); lostUsers.AddRange(allUsers); for (int i = 0; i < KinectWrapper.Constants.NuiSkeletonCount; i++) { KinectWrapper.NuiSkeletonData skeletonData = skeletonFrame.SkeletonData[i]; uint userId = skeletonData.dwTrackingID; if (skeletonData.eTrackingState == KinectWrapper.NuiSkeletonTrackingState.SkeletonTracked) { if (!AllPlayersCalibrated) { CalibrateUser(userId); } int stateNotTracked = (int)KinectWrapper.NuiSkeletonPositionTrackingState.NotTracked; if (userId == Player1ID) { //Debug.Log("user yes:" + userId.ToString()); //Waterstrong // get player position player1Pos = kinectToWorld.MultiplyPoint3x4(skeletonData.Position); player1Pos.z = -player1Pos.z; //Debug.Log(String.Format("({0}, {1}, {2})", player1Pos.x, player1Pos.y, player1Pos.z)); //CalibrationText.guiText.text = String.Format("({0:F1}, {1:F1}, {2:F1})", player1Pos.x, player1Pos.y, player1Pos.z); // get joints rotation for (int j = 0; j < (int)KinectWrapper.NuiSkeletonPositionIndex.Count; j++) { player1JointsTracked[j] = (int)skeletonData.eSkeletonPositionTrackingState[j] != stateNotTracked; if (player1JointsTracked[j]) { player1JointsPos[j] = kinectToWorld.MultiplyPoint3x4(skeletonData.SkeletonPositions[j]); player1JointsPos[j].z = -player1JointsPos[j].z; } } // get joint orientations KinectWrapper.GetSkeletonJointOrientation(ref player1JointsPos, ref player1JointsTracked, ref player1JointsOri); // get player rotation player1Ori = player1JointsOri[(int)KinectWrapper.NuiSkeletonPositionIndex.HipCenter]; // Waterstrong Add UI //_adaptiveUi.SetUiCenter(player1JointsPos[(int)KinectWrapper.NuiSkeletonPositionIndex.Head], player1JointsPos[(int)KinectWrapper.NuiSkeletonPositionIndex.HandLeft], player1JointsPos[(int)KinectWrapper.NuiSkeletonPositionIndex.HandRight]); // Waterstrong Add FeatureData featureData = new FeatureData(); featureData.SetRelativeJoints(player1JointsPos); MotionType mt = _motion.HandleDataEx(featureData); switch (mt) { case MotionType.Jump: Debug.Log("jump"); //SendMessage("DidJumpReachApex", SendMessageOptions.DontRequireReceiver); break; //case MotionType.Left: // Debug.Log("left"); // break; //case MotionType.Right: // Debug.Log("right"); // break; default: break; } } else if (userId == Player2ID) { // get player position player2Pos = kinectToWorld.MultiplyPoint3x4(skeletonData.Position); player2Pos.z = -player2Pos.z; // get joints rotation for (int j = 0; j < (int)KinectWrapper.NuiSkeletonPositionIndex.Count; j++) { player2JointsTracked[j] = (int)skeletonData.eSkeletonPositionTrackingState[j] != stateNotTracked; if (player2JointsTracked[j]) { player2JointsPos[j] = kinectToWorld.MultiplyPoint3x4(skeletonData.SkeletonPositions[j]); player2JointsPos[j].z = -player2JointsPos[j].z; } } // get joint orientations KinectWrapper.GetSkeletonJointOrientation(ref player2JointsPos, ref player2JointsTracked, ref player2JointsOri); // get player rotation player2Ori = player2JointsOri[(int)KinectWrapper.NuiSkeletonPositionIndex.HipCenter]; } lostUsers.Remove(userId); } } // remove the lost users if any if (lostUsers.Count > 0) { foreach (uint userId in lostUsers) { RemoveUser(userId); } lostUsers.Clear(); } }