public bool AnimationFinished() { if (currentframe == AnimationFrames.Count() - 1) { return(true); } return(false); }
//====== override: GameModule public override void Initialize(GameTime gameTime) { var frames = new AnimationFrames <Color16> (GameAnimations.BlueToWhiteTransition, FramesArrangement.AfterLastFrameTravelBackToSecondFrame); colorAnimation = new Animation <Color16>(frames, gameTime, TimeSpan.FromMilliseconds(100)); colorAnimation.Start(); }
private void AnimationFrames_OnCollectionChanged(object sender, System.EventArgs e) { if (AnimationFrames.Count > 0) { enumerator = AnimationFrames.GetEnumerator(); enumerator.MoveNext(); } }
/// <summary> Changes the animation on the character </summary> /// <param name="anim"></param> public virtual void ChangeAnimation(String anim) { if (!_Animations.ContainsKey(anim)) { throw new ArgumentException($"Given animation {anim} does not exist for the character"); } _CurrentAnimation = _Animations[anim]; CurrentFrame = _CurrentAnimation.StartFrame; }
public Editor(Pat.Project proj) { ProjectReset += ResetActionIndex; AnimationReset += ResetPreviewMode; AnimationReset += ResetEditMode; Project = proj; AnimationFramesUI = new AnimationFrames(this); PreviewWindowUI = new PreviewWindow(this); AnimationListUI = new AnimationList(this); }
/// <summary> Initialises the character </summary> private void InitialiseCharacter(Vector2 bodyScale) { AddAnimations(); if (!_Animations.ContainsKey("Idle")) { throw new ArgumentException("The list of animations for the character does not have the default Idle animation"); } _CurrentAnimation = _Animations["Idle"]; Offset = new OpenTK.Vector2(_Width / 2, _Height / 2); Single boxHeight = (_Height - (_Width / 2)) * bodyScale.Y; Vector2 boxPosition = new Vector2(0, boxHeight / 2); _MainBody = PhysicsWorld.Instance.CreateRectangle(boxPosition, new Vector2(_Width * bodyScale.X, boxHeight), 5); _MainBody.BodyType = BodyType.Dynamic; _MainBody.CollisionCategories = CollisionCategory; _MainBody.Restitution = 0f; _MainBody.Friction = 0.5f; _MainBody.UserData = this; _WheelRadius = (_Width / 2) * bodyScale.X; _Wheel = PhysicsWorld.Instance.CreateCircle(boxPosition - new Vector2(0, boxHeight / 2), _WheelRadius, 5); _Wheel.BodyType = BodyType.Dynamic; _Wheel.CollisionCategories = CollisionCategory; _Wheel.Restitution = 0f; _Wheel.Friction = 1f; _Wheel.UserData = this; _WheelCircumference = (Single)(Math.PI * (_Width * bodyScale.X)); _MainBody.IgnoreCollisionWith(_Wheel); _Wheel.IgnoreCollisionWith(_MainBody); _MainBody.FixedRotation = true; _MainBody.OnCollision += OnBodyCollision; _Wheel.OnCollision += OnWheelCollision; _ConnectingJoint = PhysicsWorld.Instance.CreateRevoluteJoint(_MainBody, _Wheel, Vector2.Zero); _ConnectingJoint.CollideConnected = false; }
void OnEnable() { animationFrames = GetComponent<AnimationFrames>(); }
void OnEnable() { animationFrames = GetComponent<AnimationFrames>(); controller = transform.parent.GetComponent<BabyDragonController>(); }
void OnEnable() { animationFrames = GetComponent<AnimationFrames>(); controller = transform.parent.GetComponent<SkillController>(); currentState = null; }
void OnEnable() { animationFrames = GetComponent <AnimationFrames>(); controller = transform.parent.GetComponent <EnemyController>(); currentKey = null; }
public static void ControlableEntityAni(int Position, int ActualEndPos, List <String> Animation, int speed = 120)//240? { speed = Convert.ToInt32(speed * Globals.GameSpeed); //FIX CHANGE //meant for player and enemy if (Globals.AnimationRunning == false) { if (!(Position > 6 || Position < 1)) { Globals.AnimationRunning = true; //note the animtaion starts from the ground //all animations are square //Work out Max area animation happens so you can just render that area //Max row above the surface of the ground int RowFinal = Globals.GroundInGameY - 1; //Starting row of animation int RowInitial = RowFinal; //Starting Column of animation int ColumnInitial = ((Position - 1) * 5); //Max Column int ColumnFinal = ColumnInitial; foreach (var AnimationFrames in Animation) { //checks for the max height of animation RowInitial = Math.Min(RowInitial, Globals.GroundInGameY - AnimationFrames.Count(f => f == '%')); //checks for the max width of animation ColumnFinal = Math.Max(ColumnFinal, ColumnInitial + ((AnimationFrames.Length - AnimationFrames.Count(f => f == '%')) / AnimationFrames.Count(f => f == '%'))); } //IDK why probs 0 index ColumnFinal--; if (ColumnFinal >= Globals.GSW) { ColumnFinal = Globals.GSW - 1; } //System.Diagnostics.Debug.WriteLine($"{RowInitial},{ColumnInitial},{RowFinal},{ColumnFinal}"); //set up the Location of the Animation to change the screen list List <List <int> > Location = new List <List <int> >() { }; foreach (var AnimationFram in Animation) { List <int> FrameCoords = new List <int>() { }; //row FrameCoords.Add(Globals.GroundInGameY - AnimationFram.Count(f => f == '%')); //Column FrameCoords.Add((Position - 1) * 5); Location.Add(FrameCoords); } //Runs for each Frame of animation ------------add time for each animation for (int Frame = 0; Frame < Animation.Count; Frame++) { //Layer on animation ChangeScreen(Convert.ToInt32(Location[Frame][0]), Convert.ToInt32(Location[Frame][1]), Animation[Frame]); //Render animation RenderScreen($"{RowInitial},{ColumnInitial},{RowFinal},{ColumnFinal}"); //RenderScreen("all"); //wait to next frame //System.Diagnostics.Debug.WriteLine($"Completed Frame {Frame}"); Thread.Sleep(speed); } ResetArea(Position, ActualEndPos, RowInitial, ColumnInitial, RowFinal, ColumnFinal); RenderScreen($"{RowInitial},{ColumnInitial},{RowFinal},{ColumnFinal}"); EndAni(); } else { //catches bugs MakeErrorMessage("Position should be from 1-6 on screen"); //maybe check for next positon on map?????????????????????? } } else { //catches bugs MakeErrorMessage("Couldn't run animation as one already runnign"); } }
void OnEnable() { animationFrames = GetComponent<AnimationFrames>(); controller = transform.parent.GetComponent<EnemyController>(); currentKey = null; }
void OnEnable() { animationFrames = GetComponent <AnimationFrames>(); controller = transform.parent.GetComponent <SkillController>(); currentState = null; }
public virtual void Animate() { currentframe = (currentframe + 1) % AnimationFrames.Count(); }
public void Set(List <byte> _rawdata) { /* * DO KEEP IN MIND THAT THE COUNTERS HERE REFER TO BYTES. */ /*Using BitConverter would be a bit longer, but maybe clearer? * I think that once understood the principle, this is better. * This would be the same thing with BitConverter: * * */ //Size = BitConverter.ToUInt32(_rawdata.GetRange(0, 4).ToArray(), 0); Size = ((Data4Bytes)(_rawdata.GetRange(0, 4))).ui; ID = ((Data4Bytes)(_rawdata.GetRange(4, 4))).ui; VertexCount = ((Data4Bytes)(_rawdata.GetRange(8, 4))).ui; uint currentPositionInData = 12; //should allow for vertex size that is more than 32 bytes. uint i = VertexCount; while (i-- > 0) { uint tempsize = ((Data4Bytes)(_rawdata.GetRange((int)currentPositionInData, 4))).ui; TPVertex temp; /* We get a number of bytes that is the size + 4, because we also supply the size to the vertex object. */ temp = new TPVertex(_rawdata.GetRange((int)currentPositionInData, (int)(tempsize + 4))); Vertices.Add(temp); if (temp.PeekLog() != "") { log.AppendLine("Vertex " + i + ": " + temp.DumpLog()); } currentPositionInData += tempsize + 4; } log.AppendLine("Added " + VertexCount + " vertices"); FaceCount = ((Data4Bytes)(_rawdata.GetRange((int)currentPositionInData, 4))).ui; currentPositionInData += 4; i = FaceCount; while (i-- > 0) { uint tempsize = ((Data4Bytes)(_rawdata.GetRange((int)currentPositionInData, 4))).ui; TPFace temp; //adds face data to temp face, remembering that we are dealing with 4-byte data and the size counter counts single bytes temp = new TPFace(_rawdata.GetRange((int)currentPositionInData, (int)(tempsize + 4))); Faces.Add(temp); if (temp.PeekLog() != "") { log.AppendLine("Face " + i + ": " + temp.DumpLog()); } currentPositionInData += tempsize + 4; } log.AppendLine("Added " + FaceCount + " face(s)."); AnimationFrameCount = ((Data4Bytes)(_rawdata.GetRange((int)currentPositionInData, 4))).ui; currentPositionInData += 4; i = AnimationFrameCount; while (i-- > 0) { uint tempsize = ((Data4Bytes)(_rawdata.GetRange((int)currentPositionInData, 4))).ui; TPAnimFrame temp; temp = new TPAnimFrame(_rawdata.GetRange((int)currentPositionInData, (int)(tempsize + 4))); AnimationFrames.Add(temp); if (temp.PeekLog() != null) { log.AppendLine("Face " + i + ": " + temp.DumpLog()); } currentPositionInData += tempsize + 4; } log.AppendLine("Added " + AnimationFrameCount + " animation frame(s)."); }
void OnEnable() { animationFrames = GetComponent <AnimationFrames>(); controller = transform.parent.GetComponent <BabyDragonController>(); }
void OnEnable() { animationFrames = GetComponent <AnimationFrames>(); }
public void AddFrame(Rectangle rectangle) { AnimationFrames.Add(rectangle); CurrentRectangle = AnimationFrames[0]; }