public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position, Vector2 scale, float rotation, Vector2 physicsOffset, float physicsRadius) { ClipInstance = new ClipInstance(clip); GameScreen = gameScreen; Position = position; Scale = scale; Rotation = rotation; _physicsRadius = physicsRadius; _physicsOffset = physicsOffset; IsValid = true; SetupDynamics(); }
public override void Initialize(GameScreen parentScreen) { base.Initialize(parentScreen); // Load the clip. Note that this instance is shared with all // entities that want this clip file. Clip clip = parentScreen.Content.Load<Clip>(Settings.ClipFile); clip.Init(parentScreen.Content); // Create the ClipInstance. This allows different entities to // share the same clip and play their own animations on it ClipInstance = new ClipInstance(clip); // Set the initial position of the clip instance ClipInstance.Position = Settings.Position; ClipInstance.Origin = Settings.Origin; ClipInstance.Rotation = MathHelper.ToRadians(Settings.Rotation); ClipInstance.Scale = Settings.Scale; FlipX = Settings.FlipX; FlipY = Settings.FlipY; if (string.IsNullOrEmpty(Settings.DefaultAnimName)) { ClipInstance.Play(clip.AnimSet.Anims[0], Settings.DefaultAnimLooping); } else { ClipInstance.Play(Settings.DefaultAnimName, Settings.DefaultAnimLooping); } ClipInstance.Update(Settings.DefaultAnimOffset); }
public ClipAnimInstance(ClipInstance clipInstance) { parentClipInstance = clipInstance; // There are potentially 3 types of animation per joint JointAnimStates = new JointAnimState <JointAnim> [parentClipInstance.Clip.Joints.Length * 3]; }
public void LinkToParentClipInstance(ClipInstance parentClipInstance, int parentJointId) { linkToParentClipInstance = parentClipInstance; linkToParetJointId = parentJointId; }
public ClipAnimInstance(ClipInstance clipInstance) { parentClipInstance = clipInstance; // There are potentially 3 types of animation per joint JointAnimStates = new JointAnimState<JointAnim>[parentClipInstance.Clip.Joints.Length * 3]; }